2019-05-23 18:07:59 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-24 10:25:44 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'DevOps Score' do
|
2017-05-24 10:25:44 +00:00
|
|
|
before do
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(create(:admin))
|
2017-05-24 10:25:44 +00:00
|
|
|
end
|
|
|
|
|
2018-08-14 22:57:21 +00:00
|
|
|
it 'has dismissable intro callout', :js do
|
2019-12-03 18:06:49 +00:00
|
|
|
visit instance_statistics_dev_ops_score_index_path
|
2018-08-14 22:57:21 +00:00
|
|
|
|
2019-12-04 15:11:23 +00:00
|
|
|
expect(page).to have_content 'Introducing Your DevOps Score'
|
2018-08-14 22:57:21 +00:00
|
|
|
|
|
|
|
find('.js-close-callout').click
|
|
|
|
|
2019-12-04 15:11:23 +00:00
|
|
|
expect(page).not_to have_content 'Introducing Your DevOps Score'
|
2018-08-14 22:57:21 +00:00
|
|
|
end
|
|
|
|
|
2017-05-24 10:25:44 +00:00
|
|
|
context 'when usage ping is disabled' do
|
2018-09-06 12:43:14 +00:00
|
|
|
before do
|
2017-05-24 10:25:44 +00:00
|
|
|
stub_application_setting(usage_ping_enabled: false)
|
2018-09-06 12:43:14 +00:00
|
|
|
end
|
2017-05-24 10:25:44 +00:00
|
|
|
|
2018-09-06 12:43:14 +00:00
|
|
|
it 'shows empty state' do
|
2019-12-03 18:06:49 +00:00
|
|
|
visit instance_statistics_dev_ops_score_index_path
|
2017-05-24 10:25:44 +00:00
|
|
|
|
|
|
|
expect(page).to have_content('Usage ping is not enabled')
|
|
|
|
end
|
2018-09-06 12:43:14 +00:00
|
|
|
|
|
|
|
it 'hides the intro callout' do
|
2019-12-03 18:06:49 +00:00
|
|
|
visit instance_statistics_dev_ops_score_index_path
|
2018-09-06 12:43:14 +00:00
|
|
|
|
2019-12-04 15:11:23 +00:00
|
|
|
expect(page).not_to have_content 'Introducing Your DevOps Score'
|
2018-09-06 12:43:14 +00:00
|
|
|
end
|
2017-05-24 10:25:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is no data to display' do
|
|
|
|
it 'shows empty state' do
|
|
|
|
stub_application_setting(usage_ping_enabled: true)
|
|
|
|
|
2019-12-03 18:06:49 +00:00
|
|
|
visit instance_statistics_dev_ops_score_index_path
|
2017-05-24 10:25:44 +00:00
|
|
|
|
|
|
|
expect(page).to have_content('Data is still calculating')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is data to display' do
|
|
|
|
it 'shows numbers for each metric' do
|
|
|
|
stub_application_setting(usage_ping_enabled: true)
|
2019-11-29 06:06:31 +00:00
|
|
|
create(:dev_ops_score_metric)
|
2017-05-24 10:25:44 +00:00
|
|
|
|
2019-12-03 18:06:49 +00:00
|
|
|
visit instance_statistics_dev_ops_score_index_path
|
2017-05-24 10:25:44 +00:00
|
|
|
|
|
|
|
expect(page).to have_content(
|
|
|
|
'Issues created per active user 1.2 You 9.3 Lead 13.3%'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|