Sha256: c634e3a408d518971430f1fe0d8ad92d234b44ae275818f8fd008b6bb3346acf
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
module StampStepHelpers def month(month_name) month = Date::MONTHNAMES.index(month_name) || Date::ABBR_MONTHNAMES.index(month_name) assert (1..12).include?(month), "Invalid month: #{month_name}" return month end end World(StampStepHelpers) Given /^the date (\w+) (\d+), (\d{4})$/ do |month_name, day, year| @target = Date.new(year.to_i, month(month_name), day.to_i) end Given /^the time (\w+) (\d+), (\d+) at (\d{2}):(\d{2}):(\d{2})$/ do |month_name, day, year, hours, minutes, seconds| @target = Time.new(year.to_i, month(month_name), day.to_i, hours.to_i, minutes.to_i, seconds.to_i) end When /^I stamp the example "([^"]*)"$/ do |example| @stamped = @target.stamp(example) end Then /^I produce "([^"]*)"$/ do |expected| assert_equal expected.strip, @stamped.strip end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stamp-0.1.0 | features/step_definitions/stamp_steps.rb |