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
path: root/spec
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-06-26 12:36:16 +0300
committerJose <jvargas@gitlab.com>2018-06-27 07:06:25 +0300
commit91463e52467d4b93d95693ac4eba1d5630ecdc98 (patch)
treedabe37b1c6a169d59e1611d17e0157cf0516e33b /spec
parentc4df74d1e1ba53996c0d64a8f8ef91712bbecf75 (diff)
Specify environment actions to distinguish between metrics and every other environment related actions
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/environments_controller_spec.rb10
-rw-r--r--spec/features/projects/user_uses_shortcuts_spec.rb8
-rw-r--r--spec/helpers/environments_helper_spec.rb19
3 files changed, 37 insertions, 0 deletions
diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb
index 47d4942acbd..36ebbc8a016 100644
--- a/spec/controllers/projects/environments_controller_spec.rb
+++ b/spec/controllers/projects/environments_controller_spec.rb
@@ -277,6 +277,16 @@ describe Projects::EnvironmentsController do
end
end
+ describe 'GET #empty' do
+ it 'responds with HTML' do
+ get :empty, namespace_id: project.namespace,
+ project_id: project
+
+ expect(response).to be_ok
+ expect(response).to render_template 'empty'
+ end
+ end
+
describe 'GET #metrics' do
before do
allow(controller).to receive(:environment).and_return(environment)
diff --git a/spec/features/projects/user_uses_shortcuts_spec.rb b/spec/features/projects/user_uses_shortcuts_spec.rb
index 495a010b32c..806460ba4d4 100644
--- a/spec/features/projects/user_uses_shortcuts_spec.rb
+++ b/spec/features/projects/user_uses_shortcuts_spec.rb
@@ -110,6 +110,14 @@ describe 'User uses shortcuts', :js do
end
context 'when navigating to the Operations pages' do
+ it 'redirects to the Metrics page' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('m')
+
+ expect(page).to have_active_navigation('Operations')
+ expect(page).to have_active_sub_navigation('Metrics')
+ end
+
it 'redirects to the Environments page' do
find('body').native.send_key('g')
find('body').native.send_key('e')
diff --git a/spec/helpers/environments_helper_spec.rb b/spec/helpers/environments_helper_spec.rb
new file mode 100644
index 00000000000..c6810f9003d
--- /dev/null
+++ b/spec/helpers/environments_helper_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe EnvironmentsHelper do
+ include ApplicationHelper
+
+ describe 'operations_metrics_path' do
+ let(:project) { create(:project) }
+
+ it 'returns empty metrics path when environment is nil' do
+ expect(helper.operations_metrics_path(project, nil)).to eq(empty_project_environments_path(project))
+ end
+
+ it 'returns environment metrics path when environment is passed' do
+ environment = create(:environment, project: project)
+
+ expect(helper.operations_metrics_path(project, environment)).to eq(environment_metrics_path(environment))
+ end
+ end
+end