has_moderated 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/has_moderated.rb +1 -1
- data/lib/has_moderated/version.rb +1 -1
- data/test/dummy/app/models/hook_test.rb +2 -1
- data/test/dummy/log/development.log +253 -0
- data/test/dummy/log/test.log +4539 -0
- data/test/dummy/spec/models/hooks_spec.rb +10 -15
- metadata +3 -3
@@ -2,34 +2,29 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe HookTest do
|
4
4
|
it "should trigger on creating hook when creating a moderation (create moderation)" do
|
5
|
-
HookTest.create!(:title => "
|
5
|
+
HookTest.create!(:title => "TEST")
|
6
6
|
val = Moderation.last.attr_value
|
7
|
-
val = val[0,
|
8
|
-
val.should eq("
|
7
|
+
val = val[0, 4]
|
8
|
+
val.should eq("TEST") # this behavior is defined by the HookTest model
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should trigger on creating hook when creating a moderation (attribute change moderation)" do
|
12
|
-
HookTest.create!(:title => "
|
12
|
+
HookTest.create!(:title => "") # use blank title because of our hook, so moderation is valid
|
13
13
|
Moderation.last.accept
|
14
14
|
|
15
|
-
HookTest.first.update_attributes :title => "
|
15
|
+
HookTest.first.update_attributes :title => "TEST"
|
16
16
|
|
17
17
|
val = Moderation.last.attr_value
|
18
|
-
val = val[0,
|
19
|
-
val.should eq("
|
20
|
-
# Note: these spaces don't affect the actual value because it is in YAML format
|
21
|
-
|
22
|
-
# just to be safe
|
23
|
-
Moderation.last.accept
|
24
|
-
HookTest.first.title.should eq("Jojo")
|
18
|
+
val = val[0, 4]
|
19
|
+
val.should eq("TEST") # this behavior is defined by the HookTest model
|
25
20
|
end
|
26
21
|
|
27
22
|
# control test
|
28
23
|
it "should not have these testing spaces for other models" do
|
29
|
-
Task.create!(:title => "
|
24
|
+
Task.create!(:title => "TEST")
|
30
25
|
|
31
26
|
val = Moderation.last.attr_value
|
32
|
-
val = val[0,
|
33
|
-
val.should_not eq("
|
27
|
+
val = val[0, 4]
|
28
|
+
val.should_not eq("TEST")
|
34
29
|
end
|
35
30
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_moderated
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 21
|
10
|
+
version: 0.0.21
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jan Berdajs
|