Sha256: 4b37d70e6b15dadc0d8a543ba350a4b1487c4c4bfed4d6eb58a40ed0f39c9394

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

Given /^an empty tracking database$/ do
  Metry.current.clear
end

Then /^there should be (\d+) tracking events?$/ do |event_count|
  assert_equal(event_count.to_i, Metry.current.event_count)
end

Then /^there should be (\d+) visitors$/ do |visitor_count|
  assert_equal(visitor_count.to_i, Metry.current.visitor_count)
end

When /^there should be a tracking event "(\d+)":$/ do |id, table|
  event = Metry.current.event(id)
  assert event, "Unable to lookup event #{id}."
  table.hashes.each do |hash|
    expected = hash["value"]
    case expected
    when "_exists_"
      assert event[hash["key"]], "Key #{hash["key"]} does not exist."
    else
      assert_equal expected, event[hash["key"]], "Key #{hash["key"]} does not match."
    end
  end
end

Then /^there should be a visitor "([^\"]*)":$/ do |id, table|
  visitor = Metry.current.visitor(id)
  assert visitor, "Unable to lookup visitor #{id}."
  table.hashes.each do |hash|
    expected = hash["value"]
    case expected
    when "_exists_"
      assert visitor[hash["key"]], "Key #{hash["key"]} does not exist."
    else
      assert_equal expected, visitor[hash["key"]], "Key #{hash["key"]} does not match."
    end
  end
end

Then /^there should be a visitor "([^\"]*)"$/ do |id|
  assert Metry.current.visitor(id)
end

Version data entries

12 entries across 6 versions & 1 rubygems

Version Path
metry-2.0.4 features/step_definitions/tracking.rb
metry-2.0.4 radiant/example/features/step_definitions/tracking.rb
metry-2.0.5 radiant/example/features/step_definitions/tracking.rb
metry-2.0.5 features/step_definitions/tracking.rb
metry-2.0.0 radiant/example/features/step_definitions/tracking.rb
metry-2.0.0 features/step_definitions/tracking.rb
metry-2.0.1 features/step_definitions/tracking.rb
metry-2.0.1 radiant/example/features/step_definitions/tracking.rb
metry-2.0.2 features/step_definitions/tracking.rb
metry-2.0.2 radiant/example/features/step_definitions/tracking.rb
metry-2.0.3 features/step_definitions/tracking.rb
metry-2.0.3 radiant/example/features/step_definitions/tracking.rb