Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-14 18:08:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-14 18:08:14 +0300
commit87f286558de1f5790b0b1742f10548387b5d147a (patch)
treec483d5f3542094d2123c8116ffee22430d9ad9c9 /spec/controllers
parent674e7e2c3d295704bdf504dd0caa2e5a2d9b5cd2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/graphql_controller_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb
index fcfda61f0dd..68150504fe3 100644
--- a/spec/controllers/graphql_controller_spec.rb
+++ b/spec/controllers/graphql_controller_spec.rb
@@ -32,7 +32,7 @@ describe GraphqlController do
describe 'POST #execute' do
context 'when user is logged in' do
- let(:user) { create(:user) }
+ let(:user) { create(:user, last_activity_on: Date.yesterday) }
before do
sign_in(user)
@@ -56,6 +56,19 @@ describe GraphqlController do
expect(response).to have_gitlab_http_status(:forbidden)
expect(response).to render_template('errors/access_denied')
end
+
+ it 'updates the users last_activity_on field' do
+ expect { post :execute }.to change { user.reload.last_activity_on }
+ end
+ end
+
+ context 'when user uses an API token' do
+ let(:user) { create(:user, last_activity_on: Date.yesterday) }
+ let(:token) { create(:personal_access_token, user: user, scopes: [:api]) }
+
+ it 'updates the users last_activity_on field' do
+ expect { post :execute, params: { access_token: token.token } }.to change { user.reload.last_activity_on }
+ end
end
context 'when user is not logged in' do