2017-02-24 21:37:32 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-06-29 04:13:10 +00:00
|
|
|
feature 'User uploads avatar to group' do
|
2017-02-24 21:37:32 +00:00
|
|
|
scenario 'they see the new avatar' do
|
|
|
|
user = create(:user)
|
|
|
|
group = create(:group)
|
|
|
|
group.add_owner(user)
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2017-02-24 21:37:32 +00:00
|
|
|
|
|
|
|
visit edit_group_path(group)
|
|
|
|
attach_file(
|
|
|
|
'group_avatar',
|
|
|
|
Rails.root.join('spec', 'fixtures', 'dk.png'),
|
|
|
|
visible: false
|
|
|
|
)
|
|
|
|
|
2018-05-28 15:02:04 +00:00
|
|
|
page.within('.gs-general') do
|
|
|
|
click_button 'Save group'
|
|
|
|
end
|
2017-02-24 21:37:32 +00:00
|
|
|
|
|
|
|
visit group_path(group)
|
|
|
|
|
2017-07-24 17:36:52 +00:00
|
|
|
expect(page).to have_selector(%Q(img[data-src$="/uploads/-/system/group/avatar/#{group.id}/dk.png"]))
|
2017-02-24 21:37:32 +00:00
|
|
|
|
|
|
|
# Cheating here to verify something that isn't user-facing, but is important
|
|
|
|
expect(group.reload.avatar.file).to exist
|
|
|
|
end
|
|
|
|
end
|