blob: dac7d8c94ff0db1ea896456177354d8738a6fe3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# frozen_string_literal: true
RSpec.shared_examples 'a Trackable Controller' do
describe '#track_event', :snowplow 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', :snowplow do
get :index
expect_snowplow_event(category: 'AnonymousController', action: '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
get :index
expect_snowplow_event(category: 'SomeCategory', action: 'some_event', label: 'errorlabel')
end
end
end
end
|