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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.5 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
2022-10-11 01:57:18 +05:30
2022-11-25 23:54:43 +05:30
it_behaves_like 'Snowplow event tracking with RedisHLL context' do
2022-10-11 01:57:18 +05:30
subject { get :show, params: request_params, format: :html }
let(:request_params) { { namespace_id: project.namespace, project_id: project } }
let(:feature_flag_name) { :route_hll_to_snowplow_phase2 }
let(:category) { described_class.name }
let(:action) { 'perform_analytics_usage_action' }
let(:namespace) { project.namespace }
let(:label) { 'redis_hll_counters.analytics.analytics_total_unique_counts_monthly' }
let(:property) { 'p_analytics_valuestream' }
end
2020-07-28 23:09:34 +05:30
end
2020-10-24 23:57:45 +05:30
include_examples GracefulTimeoutHandling
2017-08-17 22:00:37 +05:30
end