Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created April 15, 2009 20:46
Show Gist options
  • Save dchelimsky/96016 to your computer and use it in GitHub Desktop.
Save dchelimsky/96016 to your computer and use it in GitHub Desktop.
# doesn't work for everything - just a proof of concept
module Expect
def expect(actual, matcher)
unless matcher.matches?(actual)
raise Spec::Expectations::ExpectationNotMetError.new(matcher.failure_message_for_should)
end
end
end
Rspec.configure do |config|
config.include(Expect)
end
module Rspec::Matchers
alias_method :eq, :equal
end
describe 5 do
it "equals 5" do
expect 5, eq(5)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment