Commit b6f207ee authored by Luke Duncalfe's avatar Luke Duncalfe

Fix EE namespacing of DesignsCounterService

Although all tests were passing, SaveDesignsService would error when
attempting to increment the counter with:

    uninitialized constant EE::Gitlab::UsageCounters
parent 55cb82cf
...@@ -67,7 +67,7 @@ module DesignManagement ...@@ -67,7 +67,7 @@ module DesignManagement
def build_repository_action(file, design) def build_repository_action(file, design)
action = new_file?(design) ? :create : :update action = new_file?(design) ? :create : :update
on_success { ::EE::Gitlab::UsageCounters::DesignsCounter.count(action) } on_success { ::Gitlab::UsageCounters::DesignsCounter.count(action) }
{ {
action: action, action: action,
......
...@@ -10,7 +10,7 @@ module EE ...@@ -10,7 +10,7 @@ module EE
override :usage_data_counters override :usage_data_counters
def usage_data_counters def usage_data_counters
super + [::EE::Gitlab::UsageCounters::DesignsCounter] super + [::Gitlab::UsageCounters::DesignsCounter]
end end
override :features_usage_data override :features_usage_data
......
# frozen_string_literal: true # frozen_string_literal: true
module EE::Gitlab::UsageCounters module Gitlab::UsageCounters
class DesignsCounter class DesignsCounter
extend ::Gitlab::UsageDataCounters::RedisCounter extend ::Gitlab::UsageDataCounters::RedisCounter
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe EE::Gitlab::UsageCounters::DesignsCounter do describe Gitlab::UsageCounters::DesignsCounter do
it_behaves_like 'a redis usage counter', 'Designs', :create it_behaves_like 'a redis usage counter', 'Designs', :create
it_behaves_like 'a redis usage counter', 'Designs', :update it_behaves_like 'a redis usage counter', 'Designs', :update
it_behaves_like 'a redis usage counter', 'Designs', :delete it_behaves_like 'a redis usage counter', 'Designs', :delete
......
...@@ -58,7 +58,7 @@ describe DesignManagement::SaveDesignsService do ...@@ -58,7 +58,7 @@ describe DesignManagement::SaveDesignsService do
end end
it "updates the creation count" do it "updates the creation count" do
counter = EE::Gitlab::UsageCounters::DesignsCounter counter = Gitlab::UsageCounters::DesignsCounter
expect { service.execute }.to change { counter.read(:create) }.by(1) expect { service.execute }.to change { counter.read(:create) }.by(1)
end end
...@@ -131,7 +131,7 @@ describe DesignManagement::SaveDesignsService do ...@@ -131,7 +131,7 @@ describe DesignManagement::SaveDesignsService do
end end
it 'increments the update counter' do it 'increments the update counter' do
counter = EE::Gitlab::UsageCounters::DesignsCounter counter = Gitlab::UsageCounters::DesignsCounter
expect { service.execute }.to change { counter.read(:update) }.by 1 expect { service.execute }.to change { counter.read(:update) }.by 1
end end
...@@ -158,7 +158,7 @@ describe DesignManagement::SaveDesignsService do ...@@ -158,7 +158,7 @@ describe DesignManagement::SaveDesignsService do
end end
it 'counts one creation and one update' do it 'counts one creation and one update' do
counter = EE::Gitlab::UsageCounters::DesignsCounter counter = Gitlab::UsageCounters::DesignsCounter
expect { service.execute } expect { service.execute }
.to change { counter.read(:create) }.by(1) .to change { counter.read(:create) }.by(1)
.and change { counter.read(:update) }.by(1) .and change { counter.read(:update) }.by(1)
...@@ -187,7 +187,7 @@ describe DesignManagement::SaveDesignsService do ...@@ -187,7 +187,7 @@ describe DesignManagement::SaveDesignsService do
end end
it 'increments the creation count by 2' do it 'increments the creation count by 2' do
counter = EE::Gitlab::UsageCounters::DesignsCounter counter = Gitlab::UsageCounters::DesignsCounter
expect { service.execute }.to change { counter.read(:create) }.by 2 expect { service.execute }.to change { counter.read(:create) }.by 2
end end
......
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