From ab7c90331f8e77ef6c8c1d77ce817aaf066e7842 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Tue, 9 May 2017 20:54:57 +0200 Subject: [PATCH] Add :redis keyword to some specs clear state of trackable attributes The specs that rely on a correct value of the trackable attributes, should include the `:redis` keyword in the spec to ensure the state is reset between various specs. The trackable attributes being: - sign_in_count : Increased every time a sign in is made (by form, openid, oauth) - current_sign_in_at : A timestamp updated when the user signs in - last_sign_in_at : Holds the timestamp of the previous sign in - current_sign_in_ip : The remote ip updated when the user sign in - last_sign_in_ip : Holds the remote ip of the previous sign in The limiting of writing trackable attributes was introduced in gitlab-org/gitlab-ce!11053. --- spec/features/login_spec.rb | 4 ++-- spec/features/projects/members/sorting_spec.rb | 4 ++-- spec/requests/openid_connect_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb index 11d417c253d..c82e8c03343 100644 --- a/spec/features/login_spec.rb +++ b/spec/features/login_spec.rb @@ -41,7 +41,7 @@ feature 'Login', feature: true do expect(page).to have_content('Your account has been blocked.') end - it 'does not update Devise trackable attributes' do + it 'does not update Devise trackable attributes', :redis do user = create(:user, :blocked) expect { login_with(user) }.not_to change { user.reload.sign_in_count } @@ -55,7 +55,7 @@ feature 'Login', feature: true do expect(page).to have_content('Invalid Login or password.') end - it 'does not update Devise trackable attributes' do + it 'does not update Devise trackable attributes', :redis do expect { login_with(User.ghost) }.not_to change { User.ghost.reload.sign_in_count } end end diff --git a/spec/features/projects/members/sorting_spec.rb b/spec/features/projects/members/sorting_spec.rb index c7a32a65e49..b7ae5f0b925 100644 --- a/spec/features/projects/members/sorting_spec.rb +++ b/spec/features/projects/members/sorting_spec.rb @@ -68,7 +68,7 @@ feature 'Projects > Members > Sorting', feature: true do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Name, descending') end - scenario 'sorts by recent sign in' do + scenario 'sorts by recent sign in', :redis do visit_members_list(sort: :recent_sign_in) expect(first_member).to include(master.name) @@ -76,7 +76,7 @@ feature 'Projects > Members > Sorting', feature: true do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Recent sign in') end - scenario 'sorts by oldest sign in' do + scenario 'sorts by oldest sign in', :redis do visit_members_list(sort: :oldest_sign_in) expect(first_member).to include(developer.name) diff --git a/spec/requests/openid_connect_spec.rb b/spec/requests/openid_connect_spec.rb index 132c983fb0d..eb03884b8dc 100644 --- a/spec/requests/openid_connect_spec.rb +++ b/spec/requests/openid_connect_spec.rb @@ -98,7 +98,7 @@ describe 'OpenID Connect requests' do expect(@payload['sub']).to eq hashed_subject end - it 'includes the time of the last authentication' do + it 'includes the time of the last authentication', :redis do expect(@payload['auth_time']).to eq user.current_sign_in_at.to_i end