has_moderated 0.0.28 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ # Read about factories at http://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :photo_related do
5
+ photo_id 1
6
+ data "MyString"
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe PhotoRelated do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -52,4 +52,18 @@ describe Photo do
52
52
  photo = Photo.first
53
53
  assert_photo_uploaded(photo.photo)
54
54
  end
55
+
56
+ it "should not create new moderation when changing related model (issue 6)" do
57
+ photo = Photo.create!(:photo => carrierwave_test_photo)
58
+ Moderation.last.accept
59
+
60
+ Moderation.count.should eq(0)
61
+
62
+ photo = Photo.first
63
+
64
+ photo.photo_relateds.build(:data => "lala")
65
+ photo.save
66
+
67
+ Moderation.count.should eq(0)
68
+ end
55
69
  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: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 28
10
- version: 0.0.28
9
+ - 29
10
+ version: 0.0.29
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan Berdajs
@@ -15,10 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-05 00:00:00 +01:00
19
- default_executable:
18
+ date: 2012-02-09 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
22
  type: :runtime
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
@@ -31,10 +31,10 @@ dependencies:
31
31
  - 0
32
32
  - 0
33
33
  version: 3.0.0
34
- version_requirements: *id001
35
34
  name: rails
36
- prerelease: false
35
+ version_requirements: *id001
37
36
  - !ruby/object:Gem::Dependency
37
+ prerelease: false
38
38
  type: :development
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
@@ -45,9 +45,8 @@ dependencies:
45
45
  segments:
46
46
  - 0
47
47
  version: "0"
48
- version_requirements: *id002
49
48
  name: sqlite3
50
- prerelease: false
49
+ version_requirements: *id002
51
50
  description: Moderated fields or whole model instances are serialized and saved into a separate moderations table. The moderation can then be accepted and the changes will be applied to the model. This way, lookups for existing, accepted fields or entries will be much faster than if using something like Papertrail, since the changes that have not yet been accepted are stored outside of the model table - in the moderations table.
52
51
  email:
53
52
  - mrbrdo@gmail.com
@@ -91,6 +90,7 @@ files:
91
90
  - test/dummy/app/models/moderation.rb
92
91
  - test/dummy/app/models/photo.rb
93
92
  - test/dummy/app/models/photo_holder.rb
93
+ - test/dummy/app/models/photo_related.rb
94
94
  - test/dummy/app/models/subtask.rb
95
95
  - test/dummy/app/models/task.rb
96
96
  - test/dummy/app/models/task_all.rb
@@ -132,6 +132,7 @@ files:
132
132
  - test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
133
133
  - test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb
134
134
  - test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb
135
+ - test/dummy/db/migrate/20120209045206_create_photo_relateds.rb
135
136
  - test/dummy/db/schema.rb
136
137
  - test/dummy/db/test.sqlite3
137
138
  - test/dummy/log/development.log
@@ -153,6 +154,7 @@ files:
153
154
  - test/dummy/spec/factories/hone_tests.rb
154
155
  - test/dummy/spec/factories/hook_tests.rb
155
156
  - test/dummy/spec/factories/photo_holders.rb
157
+ - test/dummy/spec/factories/photo_relateds.rb
156
158
  - test/dummy/spec/factories/photos.rb
157
159
  - test/dummy/spec/factories/task_alls.rb
158
160
  - test/dummy/spec/factories/task_photos.rb
@@ -164,12 +166,12 @@ files:
164
166
  - test/dummy/spec/models/hone_test_spec.rb
165
167
  - test/dummy/spec/models/hooks_spec.rb
166
168
  - test/dummy/spec/models/photo_holder_spec.rb
169
+ - test/dummy/spec/models/photo_related_spec.rb
167
170
  - test/dummy/spec/models/photo_spec.rb
168
171
  - test/dummy/spec/models/task_photo_spec.rb
169
172
  - test/dummy/spec/models/task_spec.rb
170
173
  - test/dummy/spec/spec_helper.rb
171
174
  - test/dummy/spec/support/photos.rb
172
- has_rdoc: true
173
175
  homepage: https://github.com/mrbrdo/has_moderated
174
176
  licenses: []
175
177
 
@@ -199,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
201
  requirements: []
200
202
 
201
203
  rubyforge_project:
202
- rubygems_version: 1.6.2
204
+ rubygems_version: 1.8.15
203
205
  signing_key:
204
206
  specification_version: 3
205
207
  summary: Moderate fields or entire model instances.
@@ -219,6 +221,7 @@ test_files:
219
221
  - test/dummy/app/models/moderation.rb
220
222
  - test/dummy/app/models/photo.rb
221
223
  - test/dummy/app/models/photo_holder.rb
224
+ - test/dummy/app/models/photo_related.rb
222
225
  - test/dummy/app/models/subtask.rb
223
226
  - test/dummy/app/models/task.rb
224
227
  - test/dummy/app/models/task_all.rb
@@ -260,6 +263,7 @@ test_files:
260
263
  - test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
261
264
  - test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb
262
265
  - test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb
266
+ - test/dummy/db/migrate/20120209045206_create_photo_relateds.rb
263
267
  - test/dummy/db/schema.rb
264
268
  - test/dummy/db/test.sqlite3
265
269
  - test/dummy/log/development.log
@@ -281,6 +285,7 @@ test_files:
281
285
  - test/dummy/spec/factories/hone_tests.rb
282
286
  - test/dummy/spec/factories/hook_tests.rb
283
287
  - test/dummy/spec/factories/photo_holders.rb
288
+ - test/dummy/spec/factories/photo_relateds.rb
284
289
  - test/dummy/spec/factories/photos.rb
285
290
  - test/dummy/spec/factories/task_alls.rb
286
291
  - test/dummy/spec/factories/task_photos.rb
@@ -292,6 +297,7 @@ test_files:
292
297
  - test/dummy/spec/models/hone_test_spec.rb
293
298
  - test/dummy/spec/models/hooks_spec.rb
294
299
  - test/dummy/spec/models/photo_holder_spec.rb
300
+ - test/dummy/spec/models/photo_related_spec.rb
295
301
  - test/dummy/spec/models/photo_spec.rb
296
302
  - test/dummy/spec/models/task_photo_spec.rb
297
303
  - test/dummy/spec/models/task_spec.rb