2019-04-15 10:17:05 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-21 14:39:43 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-03 18:08:28 +00:00
|
|
|
RSpec.describe Projects::CycleAnalyticsController do
|
2017-01-25 21:44:33 +00:00
|
|
|
let(:project) { create(:project, :repository) }
|
2016-11-21 14:39:43 +00:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2016-11-21 14:39:43 +00:00
|
|
|
end
|
|
|
|
|
2019-08-14 16:12:12 +00:00
|
|
|
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-08-19 09:55:20 +00:00
|
|
|
expect(response).to be_successful
|
2019-08-14 16:12:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-22 15:09:27 +00:00
|
|
|
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
|
|
|
|
|
2020-07-17 18:09:20 +00:00
|
|
|
include_examples GracefulTimeoutHandling
|
2016-11-21 14:39:43 +00:00
|
|
|
end
|