has_moderated 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/has_moderated/moderation_model.rb +1 -1
- data/lib/has_moderated/version.rb +1 -1
- data/lib/has_moderated.rb +22 -4
- data/test/dummy/app/models/hook_test.rb +8 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20111004153147_create_hook_tests.rb +10 -0
- data/test/dummy/db/schema.rb +8 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +322 -0
- data/test/dummy/log/test.log +5439 -0
- data/test/dummy/spec/factories/hook_tests.rb +8 -0
- data/test/dummy/spec/models/hooks_spec.rb +35 -0
- metadata +11 -3
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HookTest do
|
4
|
+
it "should trigger on creating hook when creating a moderation (create moderation)" do
|
5
|
+
HookTest.create!(:title => "hello")
|
6
|
+
val = Moderation.last.attr_value
|
7
|
+
val = val[0, 2]
|
8
|
+
val.should eq(" ") # this behavior is defined by the HookTest model
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should trigger on creating hook when creating a moderation (attribute change moderation)" do
|
12
|
+
HookTest.create!(:title => "hello")
|
13
|
+
Moderation.last.accept
|
14
|
+
|
15
|
+
HookTest.first.update_attributes :title => "Jojo"
|
16
|
+
|
17
|
+
val = Moderation.last.attr_value
|
18
|
+
val = val[0, 2]
|
19
|
+
val.should eq(" ") # this behavior is defined by the HookTest model
|
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")
|
25
|
+
end
|
26
|
+
|
27
|
+
# control test
|
28
|
+
it "should not have these testing spaces for other models" do
|
29
|
+
Task.create!(:title => "Hello")
|
30
|
+
|
31
|
+
val = Moderation.last.attr_value
|
32
|
+
val = val[0, 2]
|
33
|
+
val.should_not eq(" ")
|
34
|
+
end
|
35
|
+
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: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 15
|
10
|
+
version: 0.0.15
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jan Berdajs
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- test/dummy/app/assets/stylesheets/application.css
|
75
75
|
- test/dummy/app/controllers/application_controller.rb
|
76
76
|
- test/dummy/app/helpers/application_helper.rb
|
77
|
+
- test/dummy/app/models/hook_test.rb
|
77
78
|
- test/dummy/app/models/moderation.rb
|
78
79
|
- test/dummy/app/models/photo.rb
|
79
80
|
- test/dummy/app/models/subtask.rb
|
@@ -106,6 +107,7 @@ files:
|
|
106
107
|
- test/dummy/db/migrate/20110908025606_add_task_all_id_to_subtasks.rb
|
107
108
|
- test/dummy/db/migrate/20111003205633_create_photos.rb
|
108
109
|
- test/dummy/db/migrate/20111003234101_create_task_photos.rb
|
110
|
+
- test/dummy/db/migrate/20111004153147_create_hook_tests.rb
|
109
111
|
- test/dummy/db/schema.rb
|
110
112
|
- test/dummy/db/test.sqlite3
|
111
113
|
- test/dummy/falaf/test.rb
|
@@ -118,9 +120,11 @@ files:
|
|
118
120
|
- test/dummy/public/uploads/task_photo/photo/logo_arnes.gif
|
119
121
|
- test/dummy/Rakefile
|
120
122
|
- test/dummy/script/rails
|
123
|
+
- test/dummy/spec/factories/hook_tests.rb
|
121
124
|
- test/dummy/spec/factories/photos.rb
|
122
125
|
- test/dummy/spec/factories/task_alls.rb
|
123
126
|
- test/dummy/spec/factories/task_photos.rb
|
127
|
+
- test/dummy/spec/models/hooks_spec.rb
|
124
128
|
- test/dummy/spec/models/photo_spec.rb
|
125
129
|
- test/dummy/spec/models/task_photo_spec.rb
|
126
130
|
- test/dummy/spec/models/task_spec.rb
|
@@ -164,6 +168,7 @@ test_files:
|
|
164
168
|
- test/dummy/app/assets/stylesheets/application.css
|
165
169
|
- test/dummy/app/controllers/application_controller.rb
|
166
170
|
- test/dummy/app/helpers/application_helper.rb
|
171
|
+
- test/dummy/app/models/hook_test.rb
|
167
172
|
- test/dummy/app/models/moderation.rb
|
168
173
|
- test/dummy/app/models/photo.rb
|
169
174
|
- test/dummy/app/models/subtask.rb
|
@@ -196,6 +201,7 @@ test_files:
|
|
196
201
|
- test/dummy/db/migrate/20110908025606_add_task_all_id_to_subtasks.rb
|
197
202
|
- test/dummy/db/migrate/20111003205633_create_photos.rb
|
198
203
|
- test/dummy/db/migrate/20111003234101_create_task_photos.rb
|
204
|
+
- test/dummy/db/migrate/20111004153147_create_hook_tests.rb
|
199
205
|
- test/dummy/db/schema.rb
|
200
206
|
- test/dummy/db/test.sqlite3
|
201
207
|
- test/dummy/falaf/test.rb
|
@@ -208,9 +214,11 @@ test_files:
|
|
208
214
|
- test/dummy/public/uploads/task_photo/photo/logo_arnes.gif
|
209
215
|
- test/dummy/Rakefile
|
210
216
|
- test/dummy/script/rails
|
217
|
+
- test/dummy/spec/factories/hook_tests.rb
|
211
218
|
- test/dummy/spec/factories/photos.rb
|
212
219
|
- test/dummy/spec/factories/task_alls.rb
|
213
220
|
- test/dummy/spec/factories/task_photos.rb
|
221
|
+
- test/dummy/spec/models/hooks_spec.rb
|
214
222
|
- test/dummy/spec/models/photo_spec.rb
|
215
223
|
- test/dummy/spec/models/task_photo_spec.rb
|
216
224
|
- test/dummy/spec/models/task_spec.rb
|