Commit 1e5c04b9 authored by Ruben Davila's avatar Ruben Davila

Always use `fixture_file_upload` helper to upload files in tests.

* Also is not a good idea to use File.open without closing the file
  handler. We should use it with a block or close it explicitly.
parent e37bf8d7
...@@ -7,7 +7,7 @@ describe GroupsHelper do ...@@ -7,7 +7,7 @@ describe GroupsHelper do
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif') avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
it 'returns an url for the avatar' do it 'returns an url for the avatar' do
group.avatar = File.open(avatar_file_path) group.avatar = fixture_file_upload(avatar_file_path)
group.save! group.save!
expect(group_icon(group.path).to_s).to match("/uploads/group/avatar/#{group.id}/banana_sample.gif") expect(group_icon(group.path).to_s).to match("/uploads/group/avatar/#{group.id}/banana_sample.gif")
end end
...@@ -26,7 +26,7 @@ describe GroupsHelper do ...@@ -26,7 +26,7 @@ describe GroupsHelper do
end end
it 'returns an url for the avatar pointing to the primary node base url' do it 'returns an url for the avatar pointing to the primary node base url' do
group.avatar = File.open(avatar_file_path) group.avatar = fixture_file_upload(avatar_file_path)
group.save! group.save!
expect(group_icon(group.path).to_s).to match("#{geo_url}/uploads/group/avatar/#{group.id}/banana_sample.gif") expect(group_icon(group.path).to_s).to match("#{geo_url}/uploads/group/avatar/#{group.id}/banana_sample.gif")
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment