2015-03-12 17:51:41 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe GroupsHelper do
|
|
|
|
describe 'group_icon' do
|
2015-06-22 14:00:17 -04:00
|
|
|
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
|
2015-03-12 17:51:41 -04:00
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'returns an url for the avatar' do
|
2015-03-12 17:51:41 -04:00
|
|
|
group = create(:group)
|
|
|
|
group.avatar = File.open(avatar_file_path)
|
|
|
|
group.save!
|
|
|
|
expect(group_icon(group.path).to_s).
|
2015-12-14 21:53:52 -05:00
|
|
|
to match("/uploads/group/avatar/#{group.id}/banana_sample.gif")
|
2015-03-12 17:51:41 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'gives default avatar_icon when no avatar is present' do
|
2015-03-12 17:51:41 -04:00
|
|
|
group = create(:group)
|
|
|
|
group.save!
|
|
|
|
expect(group_icon(group.path)).to match('group_avatar.png')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|