diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 0b3833e6515..b2fdadb282b 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -57,6 +57,40 @@ describe ApplicationController do end end + describe '#track_event' do + before do + sign_in user + end + + context 'with no params' do + controller(described_class) do + def index + track_event + head :ok + end + end + + it 'tracks the action name' do + expect(Gitlab::Tracking).to receive(:event).with('AnonymousController', 'index', {}) + get :index + end + end + + context 'with params' do + controller(described_class) do + def index + track_event('some_event', category: 'SomeCategory', label: 'errorlabel') + head :ok + end + end + + it 'tracks with the specified param' do + expect(Gitlab::Tracking).to receive(:event).with('SomeCategory', 'some_event', label: 'errorlabel') + get :index + end + end + end + describe '#add_gon_variables' do before do Gon.clear |