Skip to content

Instantly share code, notes, and snippets.

@jamis
Created October 20, 2015 16:35
Show Gist options
  • Save jamis/54a21a4f6e176ffc18f5 to your computer and use it in GitHub Desktop.
Save jamis/54a21a4f6e176ffc18f5 to your computer and use it in GitHub Desktop.
Mater does Rspec: `expect.to not_to`
RSpec::Matchers.define :not_to do
match { |actual| !actual }
end
RSpec.describe "Mater" do
specify "says `to not to' to mean false" do
expect(false).to not_to
expect(true).not_to not_to
end
end
# Mater
# says `to not to' to mean false
#
# Finished in 0.00073 seconds (files took 0.14261 seconds to load)
# 1 example, 0 failures
@jamis
Copy link
Author

jamis commented Oct 20, 2015

Test failures are wonderful, too:

  1) Mater says `to not to' to mean false
     Failure/Error: expect(true).to not_to
       expected true to not to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment