Browse files

Scenario for should not with message matcher

  • Loading branch information...
1 parent 922d08e commit 13e0470409a14e59a59f8d595558e535479bfdf9 @jamesalmond committed Jan 31, 2011
Showing with 23 additions and 2 deletions.
  1. +23 −2 features/built_in_matchers/expect_error.feature
View
25 features/built_in_matchers/expect_error.feature
@@ -60,8 +60,29 @@ Feature: expect error
"""
When I run "rspec ./expect_error_with_message.rb"
Then the output should contain all of these:
- | 2 examples, 1 failure |
- | expected StandardError with "my message", got #<StandardError: another message> |
+ | 2 examples, 1 failure |
+ | expected StandardError with "my message" |
+
+ Scenario: expect no error with message
+ Given a file named "expect_no_error_with_message.rb" with:
+ """
+ describe "matching no error with message" do
+ it "should not match errors with a different message" do
+ expect{raise StandardError, 'my message'}.to_not raise_error(StandardError, "another message")
+ end
+ end
+
+ #deliberate failure
+ describe "mathcing no error with a message" do
+ it "should not match errors with a different message" do
+ expect{raise StandardError, "my message"}.to_not raise_error(StandardError, 'my message')
+ end
+ end
+ """
+ When I run "rspec ./expect_no_error_with_message.rb"
+ Then the output should contain all of these:
+ | 2 examples, 1 failure |
+ | expected no StandardError with "my message" |
Scenario: expect error with block
Given a file named "expect_error_with_block_spec.rb" with:

0 comments on commit 13e0470

Please sign in to comment.