diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-04-19 14:48:31 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-04-19 14:48:31 +0000 |
commit | 40a972057da58dd5c15cf0f0b2952f264dba0076 (patch) | |
tree | c454dd64d0e8af557ad9bf71337ad5c4014efbef /spec/controllers | |
parent | a9da37434af6d44c5f851affd4bd69b370760e8e (diff) | |
parent | 5f570690d4cf5635eb41ec43f21bdf21f79c5dda (diff) | |
download | gitlab-ce-40a972057da58dd5c15cf0f0b2952f264dba0076.tar.gz |
Merge branch 'usage-ping-port' into 'master'
Usage ping port
Closes #27750
See merge request !10481
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 37 | ||||
-rw-r--r-- | spec/controllers/sessions_controller_spec.rb | 10 |
2 files changed, 46 insertions, 1 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index 5dd8f66343f..2565622f8df 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -3,12 +3,49 @@ require 'spec_helper' describe Admin::ApplicationSettingsController do include StubENV + let(:group) { create(:group) } + let(:project) { create(:project, namespace: group) } let(:admin) { create(:admin) } + let(:user) { create(:user)} before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') end + describe 'GET #usage_data with no access' do + before do + sign_in(user) + end + + it 'returns 404' do + get :usage_data, format: :html + + expect(response.status).to eq(404) + end + end + + describe 'GET #usage_data' do + before do + sign_in(admin) + end + + it 'returns HTML data' do + get :usage_data, format: :html + + expect(response.body).to start_with('<span') + expect(response.status).to eq(200) + end + + it 'returns JSON data' do + get :usage_data, format: :json + + body = JSON.parse(response.body) + expect(body["version"]).to eq(Gitlab::VERSION) + expect(body).to include('counts') + expect(response.status).to eq(200) + end + end + describe 'PUT #update' do before do sign_in(admin) diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index 9c16a7bc08b..038132cffe0 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -16,7 +16,9 @@ describe SessionsController do end end - context 'when using valid password' do + context 'when using valid password', :redis do + include UserActivitiesHelpers + let(:user) { create(:user) } it 'authenticates user correctly' do @@ -37,6 +39,12 @@ describe SessionsController do subject.sign_out user end end + + it 'updates the user activity' do + expect do + post(:create, user: { login: user.username, password: user.password }) + end.to change { user_activity(user) } + end end end |