debian-mirror-gitlab/spec/features/profile_spec.rb

36 lines
869 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
require 'spec_helper'
2015-04-26 12:48:37 +05:30
describe 'Profile account page', feature: true do
2014-09-02 18:07:02 +05:30
let(:user) { create(:user) }
before do
login_as :user
end
2015-04-26 12:48:37 +05:30
describe 'when signup is enabled' do
2014-09-02 18:07:02 +05:30
before do
2015-09-11 14:41:01 +05:30
stub_application_setting(signup_enabled: true)
2014-09-02 18:07:02 +05:30
visit profile_account_path
end
2015-04-26 12:48:37 +05:30
it { expect(page).to have_content('Remove account') }
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
it 'should delete the account' do
expect { click_link 'Delete account' }.to change { User.count }.by(-1)
expect(current_path).to eq(new_user_session_path)
2014-09-02 18:07:02 +05:30
end
end
2015-04-26 12:48:37 +05:30
describe 'when signup is disabled' do
2014-09-02 18:07:02 +05:30
before do
2015-09-11 14:41:01 +05:30
stub_application_setting(signup_enabled: false)
2014-09-02 18:07:02 +05:30
visit profile_account_path
end
2015-04-26 12:48:37 +05:30
it 'should not have option to remove account' do
expect(page).not_to have_content('Remove account')
expect(current_path).to eq(profile_account_path)
2014-09-02 18:07:02 +05:30
end
end
end