Commit 844000a3ffac3bb12cc7407a1065426bdbf85075
1 parent
0ceb4036
Exists in
master
and in
29 other branches
rails3: avoiding mass-assignment on profile_list_block tests
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
test/unit/profile_list_block_test.rb
... | ... | @@ -149,9 +149,9 @@ class ProfileListBlockTest < ActiveSupport::TestCase |
149 | 149 | |
150 | 150 | should 'prioritize profiles with image if this option is turned on' do |
151 | 151 | env = fast_create(Environment) |
152 | - img1 = Image.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
152 | + img1 = create(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
153 | 153 | p1 = fast_create(Person, :environment_id => env.id, :image_id => img1.id) |
154 | - img2 = Image.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
154 | + img2 = create(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
155 | 155 | p2 = fast_create(Person, :environment_id => env.id, :image_id => img2.id) |
156 | 156 | |
157 | 157 | p_without_image = fast_create(Person, :environment_id => env.id) |
... | ... | @@ -165,9 +165,9 @@ class ProfileListBlockTest < ActiveSupport::TestCase |
165 | 165 | |
166 | 166 | should 'list profiles without image only if profiles with image arent enought' do |
167 | 167 | env = fast_create(Environment) |
168 | - img1 = Image.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
168 | + img1 = create(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
169 | 169 | p1 = fast_create(Person, :environment_id => env.id, :image_id => img1.id) |
170 | - img2 = Image.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
170 | + img2 = create(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
171 | 171 | p2 = fast_create(Person, :environment_id => env.id, :image_id => img2.id) |
172 | 172 | p_without_image = fast_create(Person, :environment_id => env.id) |
173 | 173 | block = ProfileListBlock.new |
... | ... | @@ -186,7 +186,7 @@ class ProfileListBlockTest < ActiveSupport::TestCase |
186 | 186 | 5.times do |n| |
187 | 187 | fast_create(Person, :environment_id => env.id) |
188 | 188 | end |
189 | - img = Image.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
189 | + img = create(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
190 | 190 | with_image = fast_create(Person, :environment_id => env.id, :image_id => img.id) |
191 | 191 | block = ProfileListBlock.new(:limit => 3) |
192 | 192 | block.stubs(:prioritize_profiles_with_image).returns(true) |
... | ... | @@ -196,7 +196,7 @@ class ProfileListBlockTest < ActiveSupport::TestCase |
196 | 196 | |
197 | 197 | should 'not prioritize profiles with image if this option is turned off' do |
198 | 198 | env = fast_create(Environment) |
199 | - img = Image.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
199 | + img = create(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
200 | 200 | with_image = fast_create(Person, :environment_id => env.id, :updated_at => DateTime.now, :image_id => img.id) |
201 | 201 | 5.times do |n| |
202 | 202 | fast_create(Person, :environment_id => env.id, :updated_at => DateTime.now + 1.day) | ... | ... |