the_moderator 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/README.md +2 -0
- data/lib/the_moderator/version.rb +1 -1
- data/spec/the_moderator/model_spec.rb +5 -5
- data/spec/the_moderator/moderation_model_spec.rb +5 -5
- data/the_moderator.gemspec +3 -3
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c787c1c3e6f7025ead3692dba90fc55e1b4e38ee
|
4
|
+
data.tar.gz: eafd6e898c538d2c482198f91d84ddce105781c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4da06fc770cf6c60d15a4ef709297a6269dff7368581e9e0a76b4e2380282d11903581508b2debc2c22cf7f387e5662ca3b68a1bb7042f24891e472973a47433
|
7
|
+
data.tar.gz: 50b95087c21e282ff295490804bf4dd14d86cfceba4bd96f63bd2d484978f569b59bb3ad8457e9bab80ed9bc6bafd5439f3cb050da5107d0a7509d771773d1aa
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# TheModerator
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/gdott9/the_moderator.svg?branch=master)](https://travis-ci.org/gdott9/the_moderator)
|
4
|
+
|
3
5
|
Moderate fields before their insertion in the database by serializing and saving them into a separate 'moderations' table.
|
4
6
|
|
5
7
|
## Installation
|
@@ -6,7 +6,7 @@ describe TheModerator::Model do
|
|
6
6
|
page = Page.new(name: 'Name', content: 'Content')
|
7
7
|
page.moderate(:name)
|
8
8
|
|
9
|
-
expect(page.moderations).to
|
9
|
+
expect(page.moderations.size).to eq(1)
|
10
10
|
expect(page.moderations.first.data[:attributes]).to include(name: 'Name')
|
11
11
|
expect(page.name).to be_nil
|
12
12
|
expect(page.content).to eq('Content')
|
@@ -21,7 +21,7 @@ describe TheModerator::Model do
|
|
21
21
|
name: 'name', content: 'content', id: category.page.id}}
|
22
22
|
category.moderate(page: :name)
|
23
23
|
|
24
|
-
expect(category.moderations).to
|
24
|
+
expect(category.moderations.size).to eq(1)
|
25
25
|
expect(category.moderations.first.data[:attributes])
|
26
26
|
.to include(page_attributes: {name: 'name', id: category.page.id})
|
27
27
|
expect(category.page.name).to be_nil
|
@@ -35,7 +35,7 @@ describe TheModerator::Model do
|
|
35
35
|
page.attributes = {links_attributes: [{id: link.id, name: 'link'}]}
|
36
36
|
page.moderate(links: [:name])
|
37
37
|
|
38
|
-
expect(page.moderations).to
|
38
|
+
expect(page.moderations.size).to eq(1)
|
39
39
|
expect(page.moderations.first.data[:attributes])
|
40
40
|
.to include(links_attributes: {link.id => {name: 'link', id: link.id}})
|
41
41
|
expect(link.name).to be_nil
|
@@ -47,8 +47,8 @@ describe TheModerator::Model do
|
|
47
47
|
page = Page.new(name: 'Name', content: 'Content')
|
48
48
|
page.moderate(:name)
|
49
49
|
|
50
|
-
expect(page.moderated?(:name)).to
|
51
|
-
expect(page.moderated?(:content)).to
|
50
|
+
expect(page.moderated?(:name)).to be true
|
51
|
+
expect(page.moderated?(:content)).to be false
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -15,7 +15,7 @@ describe TheModerator::ModerationModel do
|
|
15
15
|
subject.accept
|
16
16
|
|
17
17
|
expect(subject.moderatable.name).to eq('Name')
|
18
|
-
expect(subject.destroyed?).to
|
18
|
+
expect(subject.destroyed?).to be true
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -25,7 +25,7 @@ describe TheModerator::ModerationModel do
|
|
25
25
|
subject.discard
|
26
26
|
|
27
27
|
expect(subject.moderatable.name).to be_nil
|
28
|
-
expect(subject.destroyed?).to
|
28
|
+
expect(subject.destroyed?).to be true
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -34,15 +34,15 @@ describe TheModerator::ModerationModel do
|
|
34
34
|
expect(subject.moderatable.name).to be_nil
|
35
35
|
preview = subject.preview
|
36
36
|
|
37
|
-
expect(preview.frozen?).to
|
37
|
+
expect(preview.frozen?).to be true
|
38
38
|
expect(preview.name).to eq('Name')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe '#include?' do
|
43
43
|
it 'includes name' do
|
44
|
-
expect(subject.include?(:name)).to
|
45
|
-
expect(subject.include?(:content)).to
|
44
|
+
expect(subject.include?(:name)).to be true
|
45
|
+
expect(subject.include?(:content)).to be false
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/the_moderator.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "activemodel", ">= 3.2.0", "< 5.
|
22
|
-
spec.add_dependency "activerecord", ">= 3.2.0", "< 5.
|
23
|
-
spec.add_dependency "activesupport", ">= 3.2.0", "< 5.
|
21
|
+
spec.add_dependency "activemodel", ">= 3.2.0", "< 5.2"
|
22
|
+
spec.add_dependency "activerecord", ">= 3.2.0", "< 5.2"
|
23
|
+
spec.add_dependency "activesupport", ">= 3.2.0", "< 5.2"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_moderator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume DOTT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 3.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 3.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activerecord
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: 3.2.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '5.
|
42
|
+
version: '5.2'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: 3.2.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '5.
|
52
|
+
version: '5.2'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: activesupport
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: 3.2.0
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '5.
|
62
|
+
version: '5.2'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: 3.2.0
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '5.
|
72
|
+
version: '5.2'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: bundler
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,6 +149,7 @@ extra_rdoc_files: []
|
|
149
149
|
files:
|
150
150
|
- ".gitignore"
|
151
151
|
- ".rspec"
|
152
|
+
- ".travis.yml"
|
152
153
|
- Gemfile
|
153
154
|
- LICENSE.txt
|
154
155
|
- README.md
|
@@ -194,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
195
|
version: '0'
|
195
196
|
requirements: []
|
196
197
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.6.13
|
198
199
|
signing_key:
|
199
200
|
specification_version: 4
|
200
201
|
summary: Moderate fields before their insertion in the database by serializing and
|