has_moderated 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ # Read about factories at http://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :hone_as_test do
5
+ testable_id 1
6
+ testable_type "MyString"
7
+ title "MyString"
8
+ end
9
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe HoneAsTest do
4
+ it "moderates assoc on create" do
5
+ t = Task.new :title => "Test"
6
+ t.hone_as_test = HoneAsTest.new :title => "Hone"
7
+ t.save
8
+
9
+ HoneAsTest.count.should eq(0)
10
+ Task.count.should eq(0)
11
+
12
+ Moderation.last.accept
13
+ HoneAsTest.count.should eq(1)
14
+
15
+ Task.first.hone_as_test.title.should eq("Hone")
16
+ end
17
+
18
+ it "moderates assoc on update" do
19
+ t = Task.new :title => "Test"
20
+ t.save
21
+
22
+ Task.count.should eq(0)
23
+
24
+ Moderation.last.accept
25
+
26
+ t = Task.first
27
+ t.association(:hone_as_test).build :title => "Hone"
28
+ t.save
29
+ HoneAsTest.count.should eq(0)
30
+
31
+ Moderation.last.accept
32
+ HoneAsTest.count.should eq(1)
33
+
34
+ Task.first.hone_as_test.title.should eq("Hone")
35
+ end
36
+ 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: 47
4
+ hash: 45
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 24
10
- version: 0.0.24
9
+ - 25
10
+ version: 0.0.25
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-10-13 00:00:00 +02:00
18
+ date: 2011-10-18 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -83,6 +83,7 @@ files:
83
83
  - test/dummy/app/models/hjoin_test.rb
84
84
  - test/dummy/app/models/hmanythrough_join.rb
85
85
  - test/dummy/app/models/hmanythrough_test.rb
86
+ - test/dummy/app/models/hone_as_test.rb
86
87
  - test/dummy/app/models/hone_test.rb
87
88
  - test/dummy/app/models/hook_test.rb
88
89
  - test/dummy/app/models/moderation.rb
@@ -126,6 +127,7 @@ files:
126
127
  - test/dummy/db/migrate/20111009201729_add_title_to_hone_tests.rb
127
128
  - test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb
128
129
  - test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb
130
+ - test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
129
131
  - test/dummy/db/schema.rb
130
132
  - test/dummy/db/test.sqlite3
131
133
  - test/dummy/log/development.log
@@ -141,6 +143,7 @@ files:
141
143
  - test/dummy/spec/factories/hjoin_tests.rb
142
144
  - test/dummy/spec/factories/hmanythrough_joins.rb
143
145
  - test/dummy/spec/factories/hmanythrough_tests.rb
146
+ - test/dummy/spec/factories/hone_as_tests.rb
144
147
  - test/dummy/spec/factories/hone_tests.rb
145
148
  - test/dummy/spec/factories/hook_tests.rb
146
149
  - test/dummy/spec/factories/photo_holders.rb
@@ -149,6 +152,7 @@ files:
149
152
  - test/dummy/spec/factories/task_photos.rb
150
153
  - test/dummy/spec/models/hjoin_test_spec.rb
151
154
  - test/dummy/spec/models/hmanythrough_test_spec.rb
155
+ - test/dummy/spec/models/hone_as_test_spec.rb
152
156
  - test/dummy/spec/models/hone_test_spec.rb
153
157
  - test/dummy/spec/models/hooks_spec.rb
154
158
  - test/dummy/spec/models/photo_holder_spec.rb
@@ -199,6 +203,7 @@ test_files:
199
203
  - test/dummy/app/models/hjoin_test.rb
200
204
  - test/dummy/app/models/hmanythrough_join.rb
201
205
  - test/dummy/app/models/hmanythrough_test.rb
206
+ - test/dummy/app/models/hone_as_test.rb
202
207
  - test/dummy/app/models/hone_test.rb
203
208
  - test/dummy/app/models/hook_test.rb
204
209
  - test/dummy/app/models/moderation.rb
@@ -242,6 +247,7 @@ test_files:
242
247
  - test/dummy/db/migrate/20111009201729_add_title_to_hone_tests.rb
243
248
  - test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb
244
249
  - test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb
250
+ - test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
245
251
  - test/dummy/db/schema.rb
246
252
  - test/dummy/db/test.sqlite3
247
253
  - test/dummy/log/development.log
@@ -257,6 +263,7 @@ test_files:
257
263
  - test/dummy/spec/factories/hjoin_tests.rb
258
264
  - test/dummy/spec/factories/hmanythrough_joins.rb
259
265
  - test/dummy/spec/factories/hmanythrough_tests.rb
266
+ - test/dummy/spec/factories/hone_as_tests.rb
260
267
  - test/dummy/spec/factories/hone_tests.rb
261
268
  - test/dummy/spec/factories/hook_tests.rb
262
269
  - test/dummy/spec/factories/photo_holders.rb
@@ -265,6 +272,7 @@ test_files:
265
272
  - test/dummy/spec/factories/task_photos.rb
266
273
  - test/dummy/spec/models/hjoin_test_spec.rb
267
274
  - test/dummy/spec/models/hmanythrough_test_spec.rb
275
+ - test/dummy/spec/models/hone_as_test_spec.rb
268
276
  - test/dummy/spec/models/hone_test_spec.rb
269
277
  - test/dummy/spec/models/hooks_spec.rb
270
278
  - test/dummy/spec/models/photo_holder_spec.rb