has_moderated 0.0.4 → 0.0.5

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.
@@ -176,4 +176,39 @@ describe Task do
176
176
  Moderation.last.accept
177
177
  Task.count.should eq(0)
178
178
  end
179
+
180
+ it "moderates new associations on existing records" do
181
+ t = Task.create! :title => "Bye Bye"
182
+ Moderation.last.accept
183
+
184
+ t = Task.first
185
+ t.add_associations_moderated(:subtasks => [Subtask.new(:task_id => t.id, :title => "Hollywood Hills")])
186
+ t.subtasks.count.should eq(0)
187
+ t.save
188
+ t.subtasks.count.should eq(0)
189
+ Subtask.count.should eq(0)
190
+
191
+ Moderation.last.accept
192
+ t.subtasks.count.should eq(1)
193
+ Subtask.count.should eq(1)
194
+ Task.first.subtasks.first.title.should eq("Hollywood Hills")
195
+ end
196
+
197
+ it "moderates new associations to existing records on existing records" do
198
+ sub = Subtask.create! :title => "Hollywood Hills"
199
+ t = Task.create! :title => "Bye Bye"
200
+ Moderation.last.accept
201
+
202
+ t = Task.first
203
+ t.add_associations_moderated(:subtasks => [sub])
204
+ t.subtasks.count.should eq(0)
205
+ Subtask.count.should eq(1)
206
+ t.save
207
+ t.subtasks.count.should eq(0)
208
+
209
+ Moderation.last.accept
210
+ t.subtasks.count.should eq(1)
211
+ Subtask.count.should eq(1)
212
+ Task.first.subtasks.first.title.should eq("Hollywood Hills")
213
+ end
179
214
  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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan Berdajs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-08 00:00:00 +02:00
18
+ date: 2011-09-28 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency