debian-mirror-gitlab/spec/controllers/projects/cycle_analytics_controller_spec.rb

73 lines
1.9 KiB
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe Projects::CycleAnalyticsController do
2017-08-17 22:00:37 +05:30
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
before do
sign_in(user)
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-08-17 22:00:37 +05:30
end
2019-10-12 21:52:04 +05:30
context "counting page views for 'show'" do
it 'increases the counter' do
expect(Gitlab::UsageDataCounters::CycleAnalyticsCounter).to receive(:count).with(:views)
get(:show,
params: {
namespace_id: project.namespace,
project_id: project
})
2019-12-04 20:38:33 +05:30
expect(response).to be_successful
2019-10-12 21:52:04 +05:30
end
end
2020-07-28 23:09:34 +05:30
context 'tracking visits to html page' do
it_behaves_like 'tracking unique visits', :show do
let(:request_params) { { namespace_id: project.namespace, project_id: project } }
let(:target_id) { 'p_analytics_valuestream' }
end
end
2021-01-29 00:20:46 +05:30
describe 'value stream analytics not set up flag' do
2017-08-17 22:00:37 +05:30
context 'with no data' do
it 'is true' do
get(:show,
2019-02-15 15:39:39 +05:30
params: {
namespace_id: project.namespace,
project_id: project
})
2017-08-17 22:00:37 +05:30
2019-12-04 20:38:33 +05:30
expect(response).to be_successful
2017-08-17 22:00:37 +05:30
expect(assigns(:cycle_analytics_no_data)).to eq(true)
end
end
context 'with data' do
before do
issue = create(:issue, project: project, created_at: 4.days.ago)
milestone = create(:milestone, project: project, created_at: 5.days.ago)
issue.update(milestone: milestone)
2018-03-27 19:54:05 +05:30
create_merge_request_closing_issue(user, project, issue)
2017-08-17 22:00:37 +05:30
end
it 'is false' do
get(:show,
2019-02-15 15:39:39 +05:30
params: {
namespace_id: project.namespace,
project_id: project
})
2017-08-17 22:00:37 +05:30
2019-12-04 20:38:33 +05:30
expect(response).to be_successful
2017-08-17 22:00:37 +05:30
expect(assigns(:cycle_analytics_no_data)).to eq(false)
end
end
end
2020-10-24 23:57:45 +05:30
include_examples GracefulTimeoutHandling
2017-08-17 22:00:37 +05:30
end