BigW Consortium Gitlab

profile_spec.rb 869 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe 'Profile account page', feature: true do
4 5 6 7 8 9
  let(:user) { create(:user) }

  before do
    login_as :user
  end

10
  describe 'when signup is enabled' do
11
    before do
12
      stub_application_setting(signup_enabled: true)
Dmitriy Zaporozhets committed
13
      visit profile_account_path
14
    end
Dmitriy Zaporozhets committed
15

16
    it { expect(page).to have_content('Remove account') }
Dmitriy Zaporozhets committed
17

18 19
    it 'should delete the account' do
      expect { click_link 'Delete account' }.to change { User.count }.by(-1)
20
      expect(current_path).to eq(new_user_session_path)
21 22 23
    end
  end

24
  describe 'when signup is disabled' do
25
    before do
26
      stub_application_setting(signup_enabled: false)
Dmitriy Zaporozhets committed
27
      visit profile_account_path
28 29
    end

30 31
    it 'should not have option to remove account' do
      expect(page).not_to have_content('Remove account')
32
      expect(current_path).to eq(profile_account_path)
33 34
    end
  end
Dmitriy Zaporozhets committed
35
end