Skip to content

Commit

Permalink
align noop behavior to better match tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Pitale committed Nov 10, 2015
1 parent ad4da0f commit aaa5ac1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/staccato/tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ def adapter
# Useful in testing
class NoopTracker
attr_writer :adapter
# (see Tracker#initialize)
def initialize(id = nil, client_id = nil, hit_defaults = {}); end
attr_accessor :hit_defaults

# hit defaults for our noop
# @return [Hash]
def hit_defaults
{}
# (see Tracker#initialize)
def initialize(id = nil, client_id = nil, hit_defaults = {})
self.hit_defaults = hit_defaults
end

# (see Tracker#id)
Expand Down
14 changes: 14 additions & 0 deletions spec/integration/noop_tracker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
end
end

describe 'settings' do
it 'has an adapter' do
expect(tracker.respond_to?(:adapter=)).to eq(true)
end

it 'has hit defaults' do
expect(tracker.hit_defaults).to eq({})

tracker.hit_defaults[:document_hostname] = 'mysite.com'

expect(tracker.hit_defaults[:document_hostname]).to eq 'mysite.com'
end
end

describe "#event" do
before(:each) do
tracker.event({
Expand Down

0 comments on commit aaa5ac1

Please sign in to comment.