Sha256: 2f53d4a924626766290089c07cc00441a277b58247693c4a127e9a29f056c63e

Contents?: true

Size: 1.25 KB

Versions: 2

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[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

2 entries across 1 versions & 1 rubygems

Version Path
metry-1.2.0 radiant/example/features/step_definitions/tracking.rb
metry-1.2.0 features/step_definitions/tracking.rb