debian-mirror-gitlab/spec/features/projects/settings/user_changes_avatar_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Projects > Settings > User changes avatar' do
2018-10-15 14:42:47 +05:30
let(:project) { create(:project, :repository) }
let(:user) { project.creator }
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2018-10-15 14:42:47 +05:30
sign_in(user)
end
it 'saves the new avatar' do
expect(project.reload.avatar.url).to be_nil
save_avatar(project)
expect(project.reload.avatar.url).to eq "/uploads/-/system/project/avatar/#{project.id}/banana_sample.gif"
end
context 'with an avatar already set' do
before do
save_avatar(project)
end
it 'is possible to remove the avatar' do
click_link 'Remove avatar'
expect(page).not_to have_link('Remove avatar')
expect(project.reload.avatar.url).to be_nil
end
end
def save_avatar(project)
visit edit_project_path(project)
attach_file(
:project_avatar,
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
)
page.within '.general-settings' do
click_button 'Save changes'
end
end
end