Commit 626f775c authored by Doug Stull's avatar Doug Stull Committed by Rémy Coutable

Change billing in side nav experiment to use namespace

parent c827d97b
...@@ -22,7 +22,7 @@ class Groups::BillingsController < Groups::ApplicationController ...@@ -22,7 +22,7 @@ class Groups::BillingsController < Groups::ApplicationController
.execute .execute
if @plans_data if @plans_data
track_from_side_nav track_from_side_nav(relevant_group)
else else
render 'shared/billings/customers_dot_unavailable' render 'shared/billings/customers_dot_unavailable'
end end
...@@ -51,9 +51,9 @@ class Groups::BillingsController < Groups::ApplicationController ...@@ -51,9 +51,9 @@ class Groups::BillingsController < Groups::ApplicationController
gitlab_subscription.save gitlab_subscription.save
end end
def track_from_side_nav def track_from_side_nav(relevant_group)
return unless helpers.accessed_billing_from_side_nav? return unless helpers.accessed_billing_from_side_nav?
experiment(:billing_in_side_nav, user: current_user).track(:view, label: 'view_billing') experiment(:billing_in_side_nav, actor: current_user, namespace: relevant_group, sticky_to: current_user).track(:view, label: 'view_billing')
end end
end end
...@@ -118,7 +118,7 @@ module EE ...@@ -118,7 +118,7 @@ module EE
local_active_routes = { path: 'billings#index' } local_active_routes = { path: 'billings#index' }
experiment(:billing_in_side_nav, user: context.current_user) do |e| experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.group.root_ancestor, sticky_to: context.current_user) do |e|
e.control {} e.control {}
e.candidate do e.candidate do
local_active_routes = { local_active_routes = {
......
...@@ -23,7 +23,7 @@ module EE ...@@ -23,7 +23,7 @@ module EE
private private
def add_billing_sidebar_menu def add_billing_sidebar_menu
experiment(:billing_in_side_nav, user: context.current_user) do |e| experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.group.root_ancestor, sticky_to: context.current_user) do |e|
e.control {} e.control {}
e.candidate do e.candidate do
insert_menu_after(::Sidebars::Groups::Menus::AdministrationMenu, ::Sidebars::Groups::Menus::BillingMenu.new(context)) insert_menu_after(::Sidebars::Groups::Menus::AdministrationMenu, ::Sidebars::Groups::Menus::BillingMenu.new(context))
......
...@@ -23,7 +23,7 @@ module EE ...@@ -23,7 +23,7 @@ module EE
private private
def add_billing_sidebar_menu def add_billing_sidebar_menu
experiment(:billing_in_side_nav, user: context.current_user) do |e| experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.project.namespace.root_ancestor, sticky_to: context.current_user) do |e|
e.control {} e.control {}
e.candidate do e.candidate do
insert_menu_after(::Sidebars::Projects::Menus::SettingsMenu, ::Sidebars::Projects::Menus::BillingMenu.new(context)) insert_menu_after(::Sidebars::Projects::Menus::SettingsMenu, ::Sidebars::Projects::Menus::BillingMenu.new(context))
......
...@@ -73,7 +73,7 @@ module Sidebars ...@@ -73,7 +73,7 @@ module Sidebars
local_active_routes = { path: 'billings#index' } local_active_routes = { path: 'billings#index' }
experiment(:billing_in_side_nav, user: context.current_user) do |e| experiment(:billing_in_side_nav, actor: context.current_user, namespace: context.group.root_ancestor, sticky_to: context.current_user) do |e|
e.control {} e.control {}
e.candidate do e.candidate do
local_active_routes = { local_active_routes = {
......
...@@ -73,7 +73,7 @@ RSpec.describe Groups::BillingsController, :saas do ...@@ -73,7 +73,7 @@ RSpec.describe Groups::BillingsController, :saas do
it 'assigns the candidate experience and tracks the event' do it 'assigns the candidate experience and tracks the event' do
expect(experiment(:billing_in_side_nav)).to track(:view, label: 'view_billing') expect(experiment(:billing_in_side_nav)).to track(:view, label: 'view_billing')
.for(:candidate) .for(:candidate)
.with_context(user: user) .with_context(actor: user, namespace: group)
.on_next_instance .on_next_instance
get :index, params: { group_id: group, from: :side_nav } get :index, params: { group_id: group, from: :side_nav }
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Sidebars::Projects::Panel do RSpec.describe Sidebars::Projects::Panel do
let(:project) { build(:project) } let_it_be(:project) { create(:project) }
let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) } let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) }
subject(:panel) { described_class.new(context) } subject(:panel) { described_class.new(context) }
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Sidebars::Projects::Panel do RSpec.describe Sidebars::Projects::Panel do
let(:project) { build(:project) } let_it_be(:project) { create(:project) }
let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) } let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) }
subject { described_class.new(context) } subject { described_class.new(context) }
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'shared/nav/_sidebar.html.haml' do RSpec.describe 'shared/nav/_sidebar.html.haml' do
let(:project) { build(:project, id: non_existing_record_id) } let_it_be(:project) { create(:project) }
let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) } let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) }
let(:sidebar) { Sidebars::Projects::Panel.new(context) } let(:sidebar) { Sidebars::Projects::Panel.new(context) }
......
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