has_moderated 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ # Read about factories at http://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :habtm_name_test do
5
+ title "MyString"
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ # Read about factories at http://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :hmany_fk_test do
5
+ something_id 1
6
+ title "MyString"
7
+ end
8
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe HabtmNameTest do
4
+ it "moderates assoc on update" do
5
+ t = Task.new :title => "Test"
6
+ t.save
7
+
8
+ Task.count.should eq(0)
9
+
10
+ Moderation.last.accept
11
+
12
+ t = Task.first
13
+ t.habtms.create! :title => "HJoin"
14
+ HabtmNameTest.count.should eq(0)
15
+
16
+ Moderation.last.accept
17
+ HabtmNameTest.count.should eq(1)
18
+
19
+ Task.first.habtms.count.should eq(1)
20
+ Task.first.habtms.first.title.should eq("HJoin")
21
+ end
22
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe HmanyFkTest do
4
+ it "moderates assoc on create" do
5
+ t = Task.new :title => "Test"
6
+ t.lalas.build :title => "HJoin"
7
+ t.save
8
+
9
+ HmanyFkTest.count.should eq(0)
10
+ Task.count.should eq(0)
11
+
12
+ Moderation.last.accept
13
+
14
+ Task.first.lalas.count.should eq(1)
15
+ Task.first.lalas.first.title.should eq("HJoin")
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.lalas.create! :title => "HJoin"
28
+ HmanyFkTest.count.should eq(0)
29
+
30
+ Moderation.last.accept
31
+ HmanyFkTest.count.should eq(1)
32
+
33
+ Task.first.lalas.count.should eq(1)
34
+ Task.first.lalas.first.title.should eq("HJoin")
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: 45
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 25
10
- version: 0.0.25
9
+ - 26
10
+ version: 0.0.26
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan Berdajs
@@ -80,7 +80,9 @@ files:
80
80
  - test/dummy/app/assets/stylesheets/application.css
81
81
  - test/dummy/app/controllers/application_controller.rb
82
82
  - test/dummy/app/helpers/application_helper.rb
83
+ - test/dummy/app/models/habtm_name_test.rb
83
84
  - test/dummy/app/models/hjoin_test.rb
85
+ - test/dummy/app/models/hmany_fk_test.rb
84
86
  - test/dummy/app/models/hmanythrough_join.rb
85
87
  - test/dummy/app/models/hmanythrough_test.rb
86
88
  - test/dummy/app/models/hone_as_test.rb
@@ -128,6 +130,8 @@ files:
128
130
  - test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb
129
131
  - test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb
130
132
  - test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
133
+ - test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb
134
+ - test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb
131
135
  - test/dummy/db/schema.rb
132
136
  - test/dummy/db/test.sqlite3
133
137
  - test/dummy/log/development.log
@@ -140,7 +144,9 @@ files:
140
144
  - test/dummy/public/uploads/task_photo/photo/1/test.jpg
141
145
  - test/dummy/Rakefile
142
146
  - test/dummy/script/rails
147
+ - test/dummy/spec/factories/habtm_name_tests.rb
143
148
  - test/dummy/spec/factories/hjoin_tests.rb
149
+ - test/dummy/spec/factories/hmany_fk_tests.rb
144
150
  - test/dummy/spec/factories/hmanythrough_joins.rb
145
151
  - test/dummy/spec/factories/hmanythrough_tests.rb
146
152
  - test/dummy/spec/factories/hone_as_tests.rb
@@ -150,7 +156,9 @@ files:
150
156
  - test/dummy/spec/factories/photos.rb
151
157
  - test/dummy/spec/factories/task_alls.rb
152
158
  - test/dummy/spec/factories/task_photos.rb
159
+ - test/dummy/spec/models/habtm_name_test_spec.rb
153
160
  - test/dummy/spec/models/hjoin_test_spec.rb
161
+ - test/dummy/spec/models/hmany_fk_test_spec.rb
154
162
  - test/dummy/spec/models/hmanythrough_test_spec.rb
155
163
  - test/dummy/spec/models/hone_as_test_spec.rb
156
164
  - test/dummy/spec/models/hone_test_spec.rb
@@ -200,7 +208,9 @@ test_files:
200
208
  - test/dummy/app/assets/stylesheets/application.css
201
209
  - test/dummy/app/controllers/application_controller.rb
202
210
  - test/dummy/app/helpers/application_helper.rb
211
+ - test/dummy/app/models/habtm_name_test.rb
203
212
  - test/dummy/app/models/hjoin_test.rb
213
+ - test/dummy/app/models/hmany_fk_test.rb
204
214
  - test/dummy/app/models/hmanythrough_join.rb
205
215
  - test/dummy/app/models/hmanythrough_test.rb
206
216
  - test/dummy/app/models/hone_as_test.rb
@@ -248,6 +258,8 @@ test_files:
248
258
  - test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb
249
259
  - test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb
250
260
  - test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
261
+ - test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb
262
+ - test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb
251
263
  - test/dummy/db/schema.rb
252
264
  - test/dummy/db/test.sqlite3
253
265
  - test/dummy/log/development.log
@@ -260,7 +272,9 @@ test_files:
260
272
  - test/dummy/public/uploads/task_photo/photo/1/test.jpg
261
273
  - test/dummy/Rakefile
262
274
  - test/dummy/script/rails
275
+ - test/dummy/spec/factories/habtm_name_tests.rb
263
276
  - test/dummy/spec/factories/hjoin_tests.rb
277
+ - test/dummy/spec/factories/hmany_fk_tests.rb
264
278
  - test/dummy/spec/factories/hmanythrough_joins.rb
265
279
  - test/dummy/spec/factories/hmanythrough_tests.rb
266
280
  - test/dummy/spec/factories/hone_as_tests.rb
@@ -270,7 +284,9 @@ test_files:
270
284
  - test/dummy/spec/factories/photos.rb
271
285
  - test/dummy/spec/factories/task_alls.rb
272
286
  - test/dummy/spec/factories/task_photos.rb
287
+ - test/dummy/spec/models/habtm_name_test_spec.rb
273
288
  - test/dummy/spec/models/hjoin_test_spec.rb
289
+ - test/dummy/spec/models/hmany_fk_test_spec.rb
274
290
  - test/dummy/spec/models/hmanythrough_test_spec.rb
275
291
  - test/dummy/spec/models/hone_as_test_spec.rb
276
292
  - test/dummy/spec/models/hone_test_spec.rb