Skip to content

Instantly share code, notes, and snippets.

@skwp
Created October 30, 2013 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwp/7226943 to your computer and use it in GitHub Desktop.
Save skwp/7226943 to your computer and use it in GitHub Desktop.
Using RSpec custom matchers to match on the format of a date.
RSpec::Matchers.define :be_a_full_datetime do |expected|
match do |datetime|
datetime =~ /\w{3} \d+, \d{4} \d{2}:\d{2}/
end
end
it "has a placed_at date" do
bid.placed_at.should be_a_full_datetime
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment