summaryrefslogtreecommitdiff
path: root/spec/features/uploads/user_uploads_avatar_to_group_spec.rb
blob: d9d6f2e2382d6fd2f37b6ce58c0c467723346cc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'rails_helper'

feature 'User uploads avatar to group', feature: true do
  scenario 'they see the new avatar' do
    user = create(:user)
    group = create(:group)
    group.add_owner(user)
    login_as(user)

    visit edit_group_path(group)
    attach_file(
      'group_avatar',
      Rails.root.join('spec', 'fixtures', 'dk.png'),
      visible: false
    )

    click_button 'Save group'

    visit group_path(group)

    expect(page).to have_selector(%Q(img[src$="/uploads/system/group/avatar/#{group.id}/dk.png"]))

    # Cheating here to verify something that isn't user-facing, but is important
    expect(group.reload.avatar.file).to exist
  end
end