diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-11-11 09:27:43 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-02-24 14:20:19 +0300 |
commit | ff19bbd3b40621ae94632b9aa68fd12645b6ed41 (patch) | |
tree | 7c198e54f2f3f6db5a9272bf79425f0b385bc96b /spec/features/profile_spec.rb | |
parent | 29540d6f35da643b4f1894dc5ffd4c0a22f7cd3e (diff) |
Deleting a user shouldn't delete associated issues.
- "Associated" issues are issues the user has created + issues that the
user is assigned to.
- Issues that a user owns are transferred to a "Ghost User" (just a
regular user with `state = 'ghost'` that is created when
`User.ghost` is called).
- Issues that a user is assigned to are moved to the "Unassigned" state.
- Fix a spec failure in `profile_spec` — a spec was asserting that when a user
is deleted, `User.count` decreases by 1. After this change, deleting a user
creates (potentially) a ghost user, causing `User.count` not to change. The
spec has been updated to look for the relevant user in the assertion.
Diffstat (limited to 'spec/features/profile_spec.rb')
-rw-r--r-- | spec/features/profile_spec.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index 7a562b5e03d..406d7cf791c 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -4,7 +4,7 @@ describe 'Profile account page', feature: true do let(:user) { create(:user) } before do - login_as :user + login_as(user) end describe 'when signup is enabled' do @@ -16,7 +16,7 @@ describe 'Profile account page', feature: true do it { expect(page).to have_content('Remove account') } it 'deletes the account' do - expect { click_link 'Delete account' }.to change { User.count }.by(-1) + expect { click_link 'Delete account' }.to change { User.where(id: user.id).count }.by(-1) expect(current_path).to eq(new_user_session_path) end end |