diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 56da1d11..81d68da9 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -170,7 +170,7 @@ Then /^the "(.*)" file should not exist$/ do |file| end Then /^I should see today's time in "(.*)"$/ do |file| - assert_match Regexp.new(Regexp.escape(Time.now.to_s)), File.open(file).readlines.join + assert_match Regexp.new(seconds_agnostic_time(Time.now)), File.open(file).readlines.join end Then /^I should see today's date in "(.*)"$/ do |file| diff --git a/features/support/env.rb b/features/support/env.rb index 5c7db508..5c550fe4 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -40,5 +40,15 @@ def location(folder, direction) [before || '.', after || '.'] end +def seconds_agnostic_time(datetime = Time.now) + pieces = datetime.to_s.split(" ") + time = "#{pieces[1].split(':').first}:#{pieces[1].split(':')[1]}:\\d{2}" + [ + Regexp.escape(pieces[0]), + time, + Regexp.escape(pieces.last) + ].join("\\ ") +end + # work around "invalid option: --format" cucumber bug (see #296) Test::Unit.run = true if RUBY_VERSION < '1.9'