Skip to content

Instantly share code, notes, and snippets.

@vutran0111
Created August 4, 2017 03:40
Show Gist options
  • Save vutran0111/1864afec89fc862d61f2f729b3121b31 to your computer and use it in GitHub Desktop.
Save vutran0111/1864afec89fc862d61f2f729b3121b31 to your computer and use it in GitHub Desktop.
bundle exec rspec spec/models/segment_hook_handler_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 14787
SegmentHookHandler
page hooks
sends the event to keen as a segment_page_view (FAILED - 1)
identify hooks
sends an identify event to keen (FAILED - 2)
when the user id is not new
updates the player traits
does not create a new player
when there are preset trait names for a new user
creates a new player
sets the value on the user
does not create new trait names
when there are new trait names
excludes the trait from the user
creates a new trait name
does not auto create live trait names
track hooks
when the event name is missing
creates a new event name
when the track has been sent before
does not process it again
with a matching rule dependent on a trait
triggers event processing logic
with a matching rule
triggers event processing logic
when there are event properties
does not set those properties on the user
and they do not match existing property names
does not auto create live attribute names
creates a new property name
when the user id is new
creates a new player
Failures:
1) SegmentHookHandler page hooks sends the event to keen as a segment_page_view
Failure/Error: expect(Keen).to receive(:publish).with('segment_page_view',anything)
(Keen).publish("segment_page_view", anything)
expected: 1 time with arguments: ("segment_page_view", anything)
received: 0 times
# ./spec/models/segment_hook_handler_spec.rb:64:in `block (3 levels) in <top (required)>'
2) SegmentHookHandler identify hooks sends an identify event to keen
Failure/Error: expect(Keen).to receive(:publish).with('identify',anything)
(Keen).publish("identify", anything)
expected: 1 time with arguments: ("identify", anything)
received: 0 times
# ./spec/models/segment_hook_handler_spec.rb:138:in `block (3 levels) in <top (required)>'
Finished in 0.94771 seconds (files took 4.33 seconds to load)
18 examples, 2 failures
Failed examples:
rspec ./spec/models/segment_hook_handler_spec.rb:63 # SegmentHookHandler page hooks sends the event to keen as a segment_page_view
rspec ./spec/models/segment_hook_handler_spec.rb:137 # SegmentHookHandler identify hooks sends an identify event to keen
Randomized with seed 14787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment