BigW Consortium Gitlab

groups_helper_spec.rb 619 Bytes
Newer Older
Dmitriy Zaporozhets committed
1 2 3 4
require 'spec_helper'

describe GroupsHelper do
  describe 'group_icon' do
5
    avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
Dmitriy Zaporozhets committed
6

7
    it 'returns an url for the avatar' do
Dmitriy Zaporozhets committed
8 9 10 11
      group = create(:group)
      group.avatar = File.open(avatar_file_path)
      group.save!
      expect(group_icon(group.path).to_s).
12
        to match("/uploads/group/avatar/#{group.id}/banana_sample.gif")
Dmitriy Zaporozhets committed
13 14
    end

15
    it 'gives default avatar_icon when no avatar is present' do
Dmitriy Zaporozhets committed
16 17 18 19 20 21
      group = create(:group)
      group.save!
      expect(group_icon(group.path)).to match('group_avatar.png')
    end
  end
end