has_moderated 1.0.alpha2 → 1.0.beta
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.
- data/README.rdoc +36 -13
- data/lib/has_moderated/associations/base.rb +4 -4
- data/lib/has_moderated/associations/collection.rb +0 -1
- data/lib/has_moderated/carrier_wave.rb +69 -46
- data/lib/has_moderated/moderated_create.rb +1 -1
- data/lib/has_moderated/moderation_model.rb +7 -3
- data/lib/has_moderated/version.rb +1 -1
- data/lib/has_moderated.rb +2 -1
- data/test/dummy/Guardfile +0 -1
- data/test/dummy/app/models/photo.rb +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120520215008_initial_schema.rb +48 -0
- data/test/dummy/db/migrate/20120520215224_create_photos.rb +13 -0
- data/test/dummy/db/schema.rb +11 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +56 -0
- data/test/dummy/log/test.log +8211 -0
- data/test/dummy/public/uploads/{task_photo/photo → photo/avatar}/1/test.jpg +0 -0
- data/test/dummy/public/uploads/{task_photo/photo → photo/avatar}/1/thumb_test.jpg +0 -0
- data/test/dummy/spec/models/photo_spec.rb +95 -0
- data/test/dummy/spec/models/task_spec.rb +74 -4
- data/test/dummy/spec/support/photos.rb +6 -2
- metadata +15 -79
- data/lib/has_moderated/associations/has_many.rb +0 -15
- data/test/dummy/db/migrate/20110901013205_create_tasks.rb +0 -10
- data/test/dummy/db/migrate/20110901013228_create_subtasks.rb +0 -11
- data/test/dummy/db/migrate/20110901013618_create_moderations.rb +0 -15
- data/test/dummy/db/migrate/20110908025410_create_task_alls.rb +0 -10
- data/test/dummy/db/migrate/20110908025606_add_task_all_id_to_subtasks.rb +0 -5
- data/test/dummy/db/migrate/20111003205633_create_photos.rb +0 -9
- data/test/dummy/db/migrate/20111003234101_create_task_photos.rb +0 -10
- data/test/dummy/db/migrate/20111004153147_create_hook_tests.rb +0 -10
- data/test/dummy/db/migrate/20111004164509_create_photo_holders.rb +0 -10
- data/test/dummy/db/migrate/20111008195728_create_hone_tests.rb +0 -9
- data/test/dummy/db/migrate/20111008195809_create_hjoin_tests.rb +0 -13
- data/test/dummy/db/migrate/20111009193145_fix_join_table.rb +0 -8
- data/test/dummy/db/migrate/20111009201729_add_title_to_hone_tests.rb +0 -5
- data/test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb +0 -9
- data/test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb +0 -11
- data/test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb +0 -11
- data/test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb +0 -10
- data/test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb +0 -13
- data/test/dummy/db/migrate/20120209045206_create_photo_relateds.rb +0 -10
- data/test/dummy/db/migrate/20120515155730_create_moderations2.rb +0 -20
- data/test/dummy/db/migrate/20120515174306_prepare_for_new_tests.rb +0 -36
- data/test/dummy/db/migrate/20120515175621_remove_photo_relateds.rb +0 -8
- data/test/dummy/spec/factories/habtm_name_tests.rb +0 -7
- data/test/dummy/spec/factories/hjoin_tests.rb +0 -7
- data/test/dummy/spec/factories/hmany_fk_tests.rb +0 -8
- data/test/dummy/spec/factories/hmanythrough_joins.rb +0 -9
- data/test/dummy/spec/factories/hmanythrough_tests.rb +0 -7
- data/test/dummy/spec/factories/hone_as_tests.rb +0 -9
- data/test/dummy/spec/factories/hone_tests.rb +0 -7
- data/test/dummy/spec/factories/hook_tests.rb +0 -8
- data/test/dummy/spec/factories/photo_holders.rb +0 -7
- data/test/dummy/spec/factories/photo_relateds.rb +0 -8
- data/test/dummy/spec/factories/photos.rb +0 -7
- data/test/dummy/spec/factories/task_alls.rb +0 -8
- data/test/dummy/spec/factories/task_photos.rb +0 -7
File without changes
|
File without changes
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/photos'
|
3
|
+
|
4
|
+
describe Photo do
|
5
|
+
before(:each) do
|
6
|
+
FileUtils.rm_rf(TEMPDIR) # remove temp dir
|
7
|
+
FileUtils.rm_rf(File.expand_path("../../../public/uploads", __FILE__)) # remove uploads dir
|
8
|
+
end
|
9
|
+
|
10
|
+
context "create moderated:" do
|
11
|
+
before do
|
12
|
+
Object.send(:remove_const, 'Photo')
|
13
|
+
load 'photo.rb'
|
14
|
+
Photo.has_moderated_create
|
15
|
+
Photo.send :include, HasModerated::CarrierWave
|
16
|
+
Photo.has_moderated_carrierwave_field :avatar
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should upload photo" do
|
20
|
+
photo = Photo.create!(:avatar => carrierwave_test_photo)
|
21
|
+
|
22
|
+
Photo.count.should eq(0)
|
23
|
+
tmpEmpty?.should be_false
|
24
|
+
uploadEmpty?.should be_true
|
25
|
+
Moderation.last.accept
|
26
|
+
tmpEmpty?.should be_true
|
27
|
+
uploadEmpty?.should be_false
|
28
|
+
|
29
|
+
Photo.count.should eq(1)
|
30
|
+
photo = Photo.first
|
31
|
+
assert_photo_uploaded(photo.avatar)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "not moderated:" do
|
36
|
+
before do
|
37
|
+
Object.send(:remove_const, 'Photo')
|
38
|
+
load 'photo.rb'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should upload photo" do
|
42
|
+
photo = Photo.create!(:avatar => carrierwave_test_photo)
|
43
|
+
|
44
|
+
tmpEmpty?.should be_true
|
45
|
+
uploadEmpty?.should be_false
|
46
|
+
|
47
|
+
Photo.count.should eq(1)
|
48
|
+
photo = Photo.first
|
49
|
+
assert_photo_uploaded(photo.avatar)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "update moderated:" do
|
54
|
+
before do
|
55
|
+
Object.send(:remove_const, 'Photo')
|
56
|
+
load 'photo.rb'
|
57
|
+
Photo.send :include, HasModerated::CarrierWave
|
58
|
+
Photo.has_moderated_carrierwave_field :avatar
|
59
|
+
Photo.has_moderated :avatar
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should moderate photo (on create)" do
|
63
|
+
photo = Photo.create! :avatar => carrierwave_test_photo
|
64
|
+
Photo.count.should eq(1)
|
65
|
+
|
66
|
+
Photo.first.avatar.file.should be_nil
|
67
|
+
tmpEmpty?.should be_false
|
68
|
+
uploadEmpty?.should be_true
|
69
|
+
|
70
|
+
Moderation.last.accept
|
71
|
+
tmpEmpty?.should be_true
|
72
|
+
uploadEmpty?.should be_false
|
73
|
+
|
74
|
+
Photo.count.should eq(1)
|
75
|
+
photo = Photo.first
|
76
|
+
assert_photo_uploaded(photo.avatar)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should moderate photo (on update)" do
|
80
|
+
photo = Photo.create!
|
81
|
+
Photo.count.should eq(1)
|
82
|
+
|
83
|
+
Photo.first.update_attributes :avatar => carrierwave_test_photo
|
84
|
+
tmpEmpty?.should be_false
|
85
|
+
uploadEmpty?.should be_true
|
86
|
+
Moderation.last.accept
|
87
|
+
tmpEmpty?.should be_true
|
88
|
+
uploadEmpty?.should be_false
|
89
|
+
|
90
|
+
Photo.count.should eq(1)
|
91
|
+
photo = Photo.first
|
92
|
+
assert_photo_uploaded(photo.avatar)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -13,7 +13,6 @@ describe Task do
|
|
13
13
|
load 'task.rb'
|
14
14
|
Object.send(:remove_const, 'Subtask') if defined? Subtask
|
15
15
|
load 'subtask.rb'
|
16
|
-
# TODO: set very obscure options
|
17
16
|
Task.has_many :renamed_subtasks, :class_name => "Subtask"
|
18
17
|
Task.has_moderated_association :renamed_subtasks
|
19
18
|
end
|
@@ -114,7 +113,76 @@ describe Task do
|
|
114
113
|
Task.last.renamed_subtasks.count.should eq(0)
|
115
114
|
end
|
116
115
|
end
|
116
|
+
|
117
|
+
#
|
118
|
+
# has_moderated_association
|
119
|
+
# has_many polymorphic
|
120
|
+
#
|
121
|
+
|
122
|
+
context "has_many polymorphic association:" do
|
123
|
+
before do
|
124
|
+
Object.send(:remove_const, 'Task') if defined? Task
|
125
|
+
load 'task.rb'
|
126
|
+
Object.send(:remove_const, 'Subtask') if defined? Subtask
|
127
|
+
load 'subtask.rb'
|
128
|
+
Task.has_many :renamed_subtasks, :class_name => "Subtask", :as => :parentable
|
129
|
+
Subtask.belongs_to :parentable, :polymorphic => true
|
130
|
+
Task.has_moderated_association :renamed_subtasks
|
131
|
+
end
|
132
|
+
|
133
|
+
it "creates and associates subtask (create)" do
|
134
|
+
task = Task.create! :title => "Task 1"
|
135
|
+
Moderation.count.should eq(0)
|
136
|
+
task.renamed_subtasks.create! :title => "Subtask 1"
|
137
|
+
|
138
|
+
task = Task.first
|
139
|
+
task.renamed_subtasks.count.should eq(0)
|
140
|
+
|
141
|
+
Moderation.count.should eq(1)
|
142
|
+
Moderation.last.accept
|
143
|
+
Moderation.count.should eq(0)
|
144
|
+
|
145
|
+
subtask = Task.first.renamed_subtasks.first
|
146
|
+
subtask.title.should eq("Subtask 1")
|
147
|
+
subtask.parentable_type.should eq("Task")
|
148
|
+
end
|
149
|
+
end
|
117
150
|
|
151
|
+
#
|
152
|
+
# has_moderated_association
|
153
|
+
# has_one polymorphic
|
154
|
+
#
|
155
|
+
|
156
|
+
context "has_one polymorphic association:" do
|
157
|
+
before do
|
158
|
+
Object.send(:remove_const, 'Task') if defined? Task
|
159
|
+
load 'task.rb'
|
160
|
+
Object.send(:remove_const, 'Subtask') if defined? Subtask
|
161
|
+
load 'subtask.rb'
|
162
|
+
Task.has_one :renamed_subtask, :class_name => "Subtask", :as => :parentable
|
163
|
+
Subtask.belongs_to :parentable, :polymorphic => true
|
164
|
+
Task.has_moderated_association :renamed_subtask
|
165
|
+
end
|
166
|
+
|
167
|
+
it "creates and associates subtask (create)" do
|
168
|
+
task = Task.create! :title => "Task 1"
|
169
|
+
Moderation.count.should eq(0)
|
170
|
+
task.renamed_subtask = Subtask.new :title => "Subtask 1"
|
171
|
+
task.save
|
172
|
+
|
173
|
+
task = Task.first
|
174
|
+
task.renamed_subtask.should be_nil
|
175
|
+
|
176
|
+
Moderation.count.should eq(1)
|
177
|
+
Moderation.last.accept
|
178
|
+
Moderation.count.should eq(0)
|
179
|
+
|
180
|
+
subtask = Task.first.renamed_subtask
|
181
|
+
subtask.title.should eq("Subtask 1")
|
182
|
+
subtask.parentable_type.should eq("Task")
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
118
186
|
#
|
119
187
|
# has_moderated_association
|
120
188
|
# has_and_belongs_to_many
|
@@ -126,7 +194,6 @@ describe Task do
|
|
126
194
|
load 'task.rb'
|
127
195
|
Object.send(:remove_const, 'Subtask')
|
128
196
|
load 'subtask.rb'
|
129
|
-
# TODO: set very obscure options
|
130
197
|
Task.has_and_belongs_to_many :renamed_subtasks, :class_name => "Subtask", :join_table => "tasks_jointable", :foreign_key => "m1_id", :association_foreign_key => "m2_id"
|
131
198
|
Subtask.has_and_belongs_to_many :renamed_tasks, :class_name => "Task", :join_table => "tasks_jointable", :foreign_key => "m2_id", :association_foreign_key => "m1_id"
|
132
199
|
Task.has_moderated_association :renamed_subtasks
|
@@ -153,6 +220,7 @@ describe Task do
|
|
153
220
|
task = Task.create! :title => "Task 1"
|
154
221
|
Subtask.create! :title => "Subtask 1"
|
155
222
|
Task.first.renamed_subtasks.count.should eq(0)
|
223
|
+
Subtask.count.should eq(1)
|
156
224
|
Moderation.count.should eq(0)
|
157
225
|
task.renamed_subtasks << Subtask.first
|
158
226
|
|
@@ -176,7 +244,6 @@ describe Task do
|
|
176
244
|
load 'task.rb'
|
177
245
|
Object.send(:remove_const, 'Subtask')
|
178
246
|
load 'subtask.rb'
|
179
|
-
# TODO: set very obscure options
|
180
247
|
Task.has_many :renamed_connections, :class_name => "TaskConnection", :foreign_key => "m1_id"
|
181
248
|
Task.has_many :renamed_subtasks, :class_name => "Subtask", :through => :renamed_connections, :source => :renamed_subtask
|
182
249
|
Subtask.has_many :renamed_connections, :class_name => "TaskConnection", :foreign_key => "m2_id"
|
@@ -202,6 +269,10 @@ describe Task do
|
|
202
269
|
|
203
270
|
subtask = Task.first.renamed_subtasks.first
|
204
271
|
subtask.title.should eq("Subtask 1")
|
272
|
+
conn = Subtask.first.renamed_connections.first
|
273
|
+
conn.title.should eq("Connection 1")
|
274
|
+
conn.renamed_subtask.title.should eq("Subtask 1")
|
275
|
+
conn.renamed_task.title.should eq("Task 1")
|
205
276
|
end
|
206
277
|
|
207
278
|
it "associates subtask 2 (update)" do
|
@@ -331,7 +402,6 @@ describe Task do
|
|
331
402
|
load 'task.rb'
|
332
403
|
Object.send(:remove_const, 'Subtask')
|
333
404
|
load 'subtask.rb'
|
334
|
-
# TODO: set very obscure options
|
335
405
|
Task.has_many :renamed_subtasks, :class_name => "Subtask"
|
336
406
|
Task.has_moderated_create :with_associations => [:renamed_subtasks]
|
337
407
|
end
|
@@ -9,8 +9,12 @@ def tmpEmpty?
|
|
9
9
|
dirEmpty?(TEMPDIR)
|
10
10
|
end
|
11
11
|
|
12
|
+
def uploadEmpty?
|
13
|
+
dirEmpty?(UPLOADDIR)
|
14
|
+
end
|
15
|
+
|
12
16
|
TEMPDIR = File.expand_path("../../../public/uploads/tmp", __FILE__)
|
13
|
-
UPLOADDIR = "/Users/apple/rails/has_moderated/test/dummy/public/uploads/photo/
|
17
|
+
UPLOADDIR = "/Users/apple/rails/has_moderated/test/dummy/public/uploads/photo/avatar/1"
|
14
18
|
|
15
19
|
def carrierwave_test_photo
|
16
20
|
test_photo_path = File.expand_path("../../../public/test.jpg", __FILE__)
|
@@ -24,5 +28,5 @@ def assert_photo_uploaded photo
|
|
24
28
|
|
25
29
|
filename = photo.file.file
|
26
30
|
File.exist?(filename)
|
27
|
-
assert(filename =~ /
|
31
|
+
assert(filename =~ /avatar\/1\/test.jpg\Z/)
|
28
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_moderated
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31098137
|
5
5
|
prerelease: 4
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 1.0.alpha2
|
9
|
+
- beta
|
10
|
+
version: 1.0.beta
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Jan Berdajs
|
@@ -66,7 +65,6 @@ files:
|
|
66
65
|
- lib/has_moderated/adapters/proxy.rb
|
67
66
|
- lib/has_moderated/associations/base.rb
|
68
67
|
- lib/has_moderated/associations/collection.rb
|
69
|
-
- lib/has_moderated/associations/has_many.rb
|
70
68
|
- lib/has_moderated/associations/has_one.rb
|
71
69
|
- lib/has_moderated/carrier_wave.rb
|
72
70
|
- lib/has_moderated/common.rb
|
@@ -86,6 +84,7 @@ files:
|
|
86
84
|
- test/dummy/app/controllers/application_controller.rb
|
87
85
|
- test/dummy/app/helpers/application_helper.rb
|
88
86
|
- test/dummy/app/models/moderation.rb
|
87
|
+
- test/dummy/app/models/photo.rb
|
89
88
|
- test/dummy/app/models/subtask.rb
|
90
89
|
- test/dummy/app/models/task.rb
|
91
90
|
- test/dummy/app/models/task_connection.rb
|
@@ -108,28 +107,8 @@ files:
|
|
108
107
|
- test/dummy/config/routes.rb
|
109
108
|
- test/dummy/config.ru
|
110
109
|
- test/dummy/db/development.sqlite3
|
111
|
-
- test/dummy/db/migrate/
|
112
|
-
- test/dummy/db/migrate/
|
113
|
-
- test/dummy/db/migrate/20110901013618_create_moderations.rb
|
114
|
-
- test/dummy/db/migrate/20110908025410_create_task_alls.rb
|
115
|
-
- test/dummy/db/migrate/20110908025606_add_task_all_id_to_subtasks.rb
|
116
|
-
- test/dummy/db/migrate/20111003205633_create_photos.rb
|
117
|
-
- test/dummy/db/migrate/20111003234101_create_task_photos.rb
|
118
|
-
- test/dummy/db/migrate/20111004153147_create_hook_tests.rb
|
119
|
-
- test/dummy/db/migrate/20111004164509_create_photo_holders.rb
|
120
|
-
- test/dummy/db/migrate/20111008195728_create_hone_tests.rb
|
121
|
-
- test/dummy/db/migrate/20111008195809_create_hjoin_tests.rb
|
122
|
-
- test/dummy/db/migrate/20111009193145_fix_join_table.rb
|
123
|
-
- test/dummy/db/migrate/20111009201729_add_title_to_hone_tests.rb
|
124
|
-
- test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb
|
125
|
-
- test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb
|
126
|
-
- test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
|
127
|
-
- test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb
|
128
|
-
- test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb
|
129
|
-
- test/dummy/db/migrate/20120209045206_create_photo_relateds.rb
|
130
|
-
- test/dummy/db/migrate/20120515155730_create_moderations2.rb
|
131
|
-
- test/dummy/db/migrate/20120515174306_prepare_for_new_tests.rb
|
132
|
-
- test/dummy/db/migrate/20120515175621_remove_photo_relateds.rb
|
110
|
+
- test/dummy/db/migrate/20120520215008_initial_schema.rb
|
111
|
+
- test/dummy/db/migrate/20120520215224_create_photos.rb
|
133
112
|
- test/dummy/db/schema.rb
|
134
113
|
- test/dummy/db/test.sqlite3
|
135
114
|
- test/dummy/Guardfile
|
@@ -140,23 +119,11 @@ files:
|
|
140
119
|
- test/dummy/public/500.html
|
141
120
|
- test/dummy/public/favicon.ico
|
142
121
|
- test/dummy/public/test.jpg
|
143
|
-
- test/dummy/public/uploads/
|
144
|
-
- test/dummy/public/uploads/
|
122
|
+
- test/dummy/public/uploads/photo/avatar/1/test.jpg
|
123
|
+
- test/dummy/public/uploads/photo/avatar/1/thumb_test.jpg
|
145
124
|
- test/dummy/Rakefile
|
146
125
|
- test/dummy/script/rails
|
147
|
-
- test/dummy/spec/
|
148
|
-
- test/dummy/spec/factories/hjoin_tests.rb
|
149
|
-
- test/dummy/spec/factories/hmany_fk_tests.rb
|
150
|
-
- test/dummy/spec/factories/hmanythrough_joins.rb
|
151
|
-
- test/dummy/spec/factories/hmanythrough_tests.rb
|
152
|
-
- test/dummy/spec/factories/hone_as_tests.rb
|
153
|
-
- test/dummy/spec/factories/hone_tests.rb
|
154
|
-
- test/dummy/spec/factories/hook_tests.rb
|
155
|
-
- test/dummy/spec/factories/photo_holders.rb
|
156
|
-
- test/dummy/spec/factories/photo_relateds.rb
|
157
|
-
- test/dummy/spec/factories/photos.rb
|
158
|
-
- test/dummy/spec/factories/task_alls.rb
|
159
|
-
- test/dummy/spec/factories/task_photos.rb
|
126
|
+
- test/dummy/spec/models/photo_spec.rb
|
160
127
|
- test/dummy/spec/models/task_spec.rb
|
161
128
|
- test/dummy/spec/spec_helper.rb
|
162
129
|
- test/dummy/spec/support/photos.rb
|
@@ -201,6 +168,7 @@ test_files:
|
|
201
168
|
- test/dummy/app/controllers/application_controller.rb
|
202
169
|
- test/dummy/app/helpers/application_helper.rb
|
203
170
|
- test/dummy/app/models/moderation.rb
|
171
|
+
- test/dummy/app/models/photo.rb
|
204
172
|
- test/dummy/app/models/subtask.rb
|
205
173
|
- test/dummy/app/models/task.rb
|
206
174
|
- test/dummy/app/models/task_connection.rb
|
@@ -223,28 +191,8 @@ test_files:
|
|
223
191
|
- test/dummy/config/routes.rb
|
224
192
|
- test/dummy/config.ru
|
225
193
|
- test/dummy/db/development.sqlite3
|
226
|
-
- test/dummy/db/migrate/
|
227
|
-
- test/dummy/db/migrate/
|
228
|
-
- test/dummy/db/migrate/20110901013618_create_moderations.rb
|
229
|
-
- test/dummy/db/migrate/20110908025410_create_task_alls.rb
|
230
|
-
- test/dummy/db/migrate/20110908025606_add_task_all_id_to_subtasks.rb
|
231
|
-
- test/dummy/db/migrate/20111003205633_create_photos.rb
|
232
|
-
- test/dummy/db/migrate/20111003234101_create_task_photos.rb
|
233
|
-
- test/dummy/db/migrate/20111004153147_create_hook_tests.rb
|
234
|
-
- test/dummy/db/migrate/20111004164509_create_photo_holders.rb
|
235
|
-
- test/dummy/db/migrate/20111008195728_create_hone_tests.rb
|
236
|
-
- test/dummy/db/migrate/20111008195809_create_hjoin_tests.rb
|
237
|
-
- test/dummy/db/migrate/20111009193145_fix_join_table.rb
|
238
|
-
- test/dummy/db/migrate/20111009201729_add_title_to_hone_tests.rb
|
239
|
-
- test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb
|
240
|
-
- test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb
|
241
|
-
- test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb
|
242
|
-
- test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb
|
243
|
-
- test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb
|
244
|
-
- test/dummy/db/migrate/20120209045206_create_photo_relateds.rb
|
245
|
-
- test/dummy/db/migrate/20120515155730_create_moderations2.rb
|
246
|
-
- test/dummy/db/migrate/20120515174306_prepare_for_new_tests.rb
|
247
|
-
- test/dummy/db/migrate/20120515175621_remove_photo_relateds.rb
|
194
|
+
- test/dummy/db/migrate/20120520215008_initial_schema.rb
|
195
|
+
- test/dummy/db/migrate/20120520215224_create_photos.rb
|
248
196
|
- test/dummy/db/schema.rb
|
249
197
|
- test/dummy/db/test.sqlite3
|
250
198
|
- test/dummy/Guardfile
|
@@ -255,23 +203,11 @@ test_files:
|
|
255
203
|
- test/dummy/public/500.html
|
256
204
|
- test/dummy/public/favicon.ico
|
257
205
|
- test/dummy/public/test.jpg
|
258
|
-
- test/dummy/public/uploads/
|
259
|
-
- test/dummy/public/uploads/
|
206
|
+
- test/dummy/public/uploads/photo/avatar/1/test.jpg
|
207
|
+
- test/dummy/public/uploads/photo/avatar/1/thumb_test.jpg
|
260
208
|
- test/dummy/Rakefile
|
261
209
|
- test/dummy/script/rails
|
262
|
-
- test/dummy/spec/
|
263
|
-
- test/dummy/spec/factories/hjoin_tests.rb
|
264
|
-
- test/dummy/spec/factories/hmany_fk_tests.rb
|
265
|
-
- test/dummy/spec/factories/hmanythrough_joins.rb
|
266
|
-
- test/dummy/spec/factories/hmanythrough_tests.rb
|
267
|
-
- test/dummy/spec/factories/hone_as_tests.rb
|
268
|
-
- test/dummy/spec/factories/hone_tests.rb
|
269
|
-
- test/dummy/spec/factories/hook_tests.rb
|
270
|
-
- test/dummy/spec/factories/photo_holders.rb
|
271
|
-
- test/dummy/spec/factories/photo_relateds.rb
|
272
|
-
- test/dummy/spec/factories/photos.rb
|
273
|
-
- test/dummy/spec/factories/task_alls.rb
|
274
|
-
- test/dummy/spec/factories/task_photos.rb
|
210
|
+
- test/dummy/spec/models/photo_spec.rb
|
275
211
|
- test/dummy/spec/models/task_spec.rb
|
276
212
|
- test/dummy/spec/spec_helper.rb
|
277
213
|
- test/dummy/spec/support/photos.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module HasModerated
|
2
|
-
module Associations
|
3
|
-
module HasMany
|
4
|
-
module ClassMethods
|
5
|
-
protected
|
6
|
-
def has_moderated_has_many_association(reflection)
|
7
|
-
# lazy load
|
8
|
-
self.send :extend, HasModerated::Associations::Collection::ClassMethods
|
9
|
-
has_moderated_collection_association(reflection)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreateModerations < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table "moderations" do |t|
|
4
|
-
t.integer "moderatable_id", :null => true
|
5
|
-
t.string "moderatable_type", :null => false
|
6
|
-
t.string "attr_name", :limit => 60, :null => false
|
7
|
-
t.text "attr_value", :null => false
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.down
|
13
|
-
drop_table :moderations
|
14
|
-
end
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class CreateHabtmNameTests < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :habtm_name_tests do |t|
|
4
|
-
t.string :title
|
5
|
-
|
6
|
-
t.timestamps
|
7
|
-
end
|
8
|
-
create_table :habtm_name_tests_tasks, :id => false do |t|
|
9
|
-
t.integer :task_id
|
10
|
-
t.integer :habtm_name_test_id
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class CreateModerations2 < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
if table_exists? :moderations # for upgrading
|
4
|
-
if Moderation.count > 0
|
5
|
-
raise "Moderations table must be empty before upgrading has_moderated!"
|
6
|
-
end
|
7
|
-
drop_table :moderations
|
8
|
-
end
|
9
|
-
create_table "moderations" do |t|
|
10
|
-
t.integer "moderatable_id", :null => true
|
11
|
-
t.string "moderatable_type", :null => true
|
12
|
-
t.text "data", :null => false
|
13
|
-
t.timestamps
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.down
|
18
|
-
drop_table :moderations
|
19
|
-
end
|
20
|
-
end
|