|
|
|
@ -4,7 +4,7 @@ require_relative './shared_avatar_examples' |
|
|
|
|
describe 'User avatar management', type: :feature, js: true do |
|
|
|
|
include Rails.application.routes.url_helpers |
|
|
|
|
|
|
|
|
|
let(:user) { FactoryGirl.create :admin } |
|
|
|
|
let(:user) { FactoryBot.create :admin } |
|
|
|
|
let(:avatar_management_path) { edit_user_path(target_user, tab: 'avatar') } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
@ -12,12 +12,12 @@ describe 'User avatar management', type: :feature, js: true do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'when user is admin' do |
|
|
|
|
let(:target_user) { FactoryGirl.create :user } |
|
|
|
|
let(:target_user) { FactoryBot.create :user } |
|
|
|
|
it_behaves_like 'avatar management' |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'when user is self' do |
|
|
|
|
let(:user) { FactoryGirl.create :user } |
|
|
|
|
let(:user) { FactoryBot.create :user } |
|
|
|
|
let(:target_user) { user } |
|
|
|
|
it 'forbids the user to access' do |
|
|
|
|
visit avatar_management_path |
|
|
|
@ -26,8 +26,8 @@ describe 'User avatar management', type: :feature, js: true do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'when user is another user' do |
|
|
|
|
let(:target_user) { FactoryGirl.create :user } |
|
|
|
|
let(:user) { FactoryGirl.create :user } |
|
|
|
|
let(:target_user) { FactoryBot.create :user } |
|
|
|
|
let(:user) { FactoryBot.create :user } |
|
|
|
|
|
|
|
|
|
it 'forbids the user to access' do |
|
|
|
|
visit avatar_management_path |
|
|
|
@ -36,7 +36,7 @@ describe 'User avatar management', type: :feature, js: true do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'none enabled' do |
|
|
|
|
let(:target_user) { FactoryGirl.create :user } |
|
|
|
|
let(:target_user) { FactoryBot.create :user } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(Setting) |
|
|
|
|