2015-04-26 12:48:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe GroupsHelper do
|
|
|
|
describe 'group_icon' do
|
2015-09-11 14:41:01 +05:30
|
|
|
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
it 'should return an url for the avatar' do
|
|
|
|
group = create(:group)
|
|
|
|
group.avatar = File.open(avatar_file_path)
|
|
|
|
group.save!
|
|
|
|
expect(group_icon(group.path).to_s).
|
2015-12-23 02:04:40 +05:30
|
|
|
to match("/uploads/group/avatar/#{group.id}/banana_sample.gif")
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'should give default avatar_icon when no avatar is present' do
|
|
|
|
group = create(:group)
|
|
|
|
group.save!
|
|
|
|
expect(group_icon(group.path)).to match('group_avatar.png')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|