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:
authorLuke Bennett <lbennett@gitlab.com>2018-09-06 15:43:14 +0300
committerPhil Hughes <me@iamphill.com>2018-09-06 15:43:14 +0300
commit7e7ca9faf1f8270d54f7731747db0d44c928492c (patch)
tree64294529de4536a0cc2e66dbc6bdd6c9f5547ae3 /spec
parent55b5264043bdecbbb5971c55c27ccbbeb0eb041e (diff)
Resolve "Remove usage ping payload from Cohorts, add to Settings"
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/instance_statistics/cohorts_controller_spec.rb14
-rw-r--r--spec/features/admin/admin_settings_spec.rb9
-rw-r--r--spec/features/instance_statistics/cohorts_spec.rb8
-rw-r--r--spec/features/instance_statistics/conversational_development_index_spec.rb10
-rw-r--r--spec/features/instance_statistics/instance_statistics.rb23
5 files changed, 55 insertions, 9 deletions
diff --git a/spec/controllers/instance_statistics/cohorts_controller_spec.rb b/spec/controllers/instance_statistics/cohorts_controller_spec.rb
index e4eedede93a..596d3c7abe5 100644
--- a/spec/controllers/instance_statistics/cohorts_controller_spec.rb
+++ b/spec/controllers/instance_statistics/cohorts_controller_spec.rb
@@ -3,5 +3,19 @@
require 'spec_helper'
describe InstanceStatistics::CohortsController do
+ let(:user) { create(:user) }
+
+ before do
+ sign_in(user)
+ end
+
it_behaves_like 'instance statistics availability'
+
+ it 'renders a 404 when the usage ping is disabled' do
+ stub_application_setting(usage_ping_enabled: false)
+
+ get :index
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
end
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index a3229fe1741..3c65b5898b4 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -336,6 +336,15 @@ describe 'Admin updates settings' do
expect(find_field('ED25519 SSH keys').value).to eq(forbidden)
end
+ it 'loads usage ping payload on click', :js do
+ expect(page).to have_button 'Preview payload'
+
+ find('.js-usage-ping-payload-trigger').click
+
+ expect(page).to have_selector '.js-usage-ping-payload'
+ expect(page).to have_button 'Hide payload'
+ end
+
def check_all_events
page.check('Active')
page.check('Push')
diff --git a/spec/features/instance_statistics/cohorts_spec.rb b/spec/features/instance_statistics/cohorts_spec.rb
index 573f8600be1..81fc5eff980 100644
--- a/spec/features/instance_statistics/cohorts_spec.rb
+++ b/spec/features/instance_statistics/cohorts_spec.rb
@@ -12,12 +12,4 @@ describe 'Cohorts page' do
expect(page).to have_content("#{Time.now.strftime('%b %Y')} 3 0")
end
-
- it 'shows usage data', :js do
- visit instance_statistics_cohorts_path
-
- wait_for_requests
-
- expect(find('.js-syntax-highlight').text).not_to eq('')
- end
end
diff --git a/spec/features/instance_statistics/conversational_development_index_spec.rb b/spec/features/instance_statistics/conversational_development_index_spec.rb
index a6c16b6a2a3..d8be554d734 100644
--- a/spec/features/instance_statistics/conversational_development_index_spec.rb
+++ b/spec/features/instance_statistics/conversational_development_index_spec.rb
@@ -16,13 +16,21 @@ describe 'Conversational Development Index' do
end
context 'when usage ping is disabled' do
- it 'shows empty state' do
+ before do
stub_application_setting(usage_ping_enabled: false)
+ end
+ it 'shows empty state' do
visit instance_statistics_conversational_development_index_index_path
expect(page).to have_content('Usage ping is not enabled')
end
+
+ it 'hides the intro callout' do
+ visit instance_statistics_conversational_development_index_index_path
+
+ expect(page).not_to have_content 'Introducing Your Conversational Development Index'
+ end
end
context 'when there is no data to display' do
diff --git a/spec/features/instance_statistics/instance_statistics.rb b/spec/features/instance_statistics/instance_statistics.rb
new file mode 100644
index 00000000000..d03e6e68075
--- /dev/null
+++ b/spec/features/instance_statistics/instance_statistics.rb
@@ -0,0 +1,23 @@
+require 'rails_helper'
+
+describe 'Cohorts page', :js do
+ before do
+ sign_in(create(:admin))
+ end
+
+ it 'hides cohorts nav button when usage ping is disabled' do
+ stub_application_setting(usage_ping_enabled: false)
+
+ visit instance_statistics_root_path
+
+ expect(find('.nav-sidebar')).not_to have_content('Cohorts')
+ end
+
+ it 'shows cohorts nav button when usage ping is enabled' do
+ stub_application_setting(usage_ping_enabled: true)
+
+ visit instance_statistics_root_path
+
+ expect(find('.nav-sidebar')).to have_content('Cohorts')
+ end
+end