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.
This commit is contained in:
Ruben Davila 2016-12-18 20:35:07 -05:00
parent 1a366e2588
commit f8dde43d41

View file

@ -6,7 +6,7 @@ describe GroupsHelper do
it 'returns an url for the avatar' do
group = create(:group)
group.avatar = File.open(avatar_file_path)
group.avatar = fixture_file_upload(avatar_file_path)
group.save!
expect(group_icon(group.path).to_s).
to match("/uploads/group/avatar/#{group.id}/banana_sample.gif")