Commit fe959906 authored by Doug Stull's avatar Doug Stull Committed by Shinya Maeda

Add buy ci minutes notification on dropdown

- prepping for experiment
parent 48c93b93
......@@ -553,6 +553,7 @@
vertical-align: text-top;
}
a.ci-minutes-emoji gl-emoji,
a.trial-link gl-emoji {
font-size: $gl-font-size;
vertical-align: baseline;
......
......@@ -26,6 +26,7 @@
- if current_user_menu?(:settings)
%li
= link_to s_("CurrentUser|Settings"), profile_path, data: { qa_selector: 'settings_link' }
= render_if_exists 'layouts/header/buy_ci_minutes'
- if current_user_menu?(:help)
%li.divider.d-md-none
......
......@@ -15,6 +15,10 @@ module EE
message.join(' ').html_safe
end
def show_buy_ci_minutes?
experiment_enabled?(:buy_ci_minutes_version_a)
end
private
def purchase_shared_runner_minutes_link
......
- return unless show_buy_ci_minutes?
%li
= link_to profile_pipeline_quota_path, class: 'ci-minutes-emoji' do
= s_("CurrentUser|Buy CI minutes")
= emoji_icon('clock9')
......@@ -138,4 +138,24 @@ describe EE::RunnersHelper do
end
end
end
describe '.show_buy_ci_minutes?' do
subject { helper.show_buy_ci_minutes? }
context 'when experiment is disabled' do
before do
allow(helper).to receive(:experiment_enabled?).with(:buy_ci_minutes_version_a).and_return(false)
end
it { is_expected.to be_falsey }
end
context 'when experiment is enabled' do
before do
allow(helper).to receive(:experiment_enabled?).with(:buy_ci_minutes_version_a).and_return(true)
end
it { is_expected.to be_truthy }
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe 'layouts/header/_current_user_dropdown' do
let_it_be(:user) { create(:user) }
let(:need_minutes) { true }
before do
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive(:show_buy_ci_minutes?).and_return(need_minutes)
render
end
subject { rendered }
context 'when ci minutes need bought' do
it 'has "Buy CI minutes" link' do
expect(subject).to have_link('Buy CI minutes')
end
end
context 'when ci minutes do not need bought' do
let(:need_minutes) { false }
it 'has no "Buy CI minutes" link' do
expect(subject).not_to have_link('Buy CI minutes')
end
end
end
......@@ -34,6 +34,12 @@ module Gitlab
environment: ::Gitlab.dev_env_or_com?,
enabled_ratio: 0.1,
tracking_category: 'Growth::Expansion::Experiment::CiNotificationDot'
},
buy_ci_minutes_version_a: {
feature_toggle: :buy_ci_minutes_version_a,
environment: ::Gitlab.dev_env_or_com?,
enabled_ratio: 0.2,
tracking_category: 'Growth::Expansion::Experiment::BuyCiMinutesVersionA'
}
}.freeze
......
......@@ -5992,6 +5992,9 @@ msgstr ""
msgid "Current vulnerabilities count"
msgstr ""
msgid "CurrentUser|Buy CI minutes"
msgstr ""
msgid "CurrentUser|Profile"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment