Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Scenario for accessing the error raised within raise_error expectation

  • Loading branch information...
commit 1c37a961b664fa5a6c7b1b6af7019a2a7768de2b 1 parent 68fff16
@jamesalmond authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 features/built_in_matchers/expect_error.feature
View
15 features/built_in_matchers/expect_error.feature
@@ -42,3 +42,18 @@ Feature: expect error
Then the output should contain "2 examples, 1 failure"
Then the output should contain "undefined method `non_existent_message'"
+ Scenario: expect error with block
+ Given a file named "expect_error_with_block_spec.rb" with:
+ """
+ describe "accessing expected error" do
+ it "should pass the error to the block" do
+ my_error = ArgumentError.new
+ expect{raise my_error}.to raise_error(ArgumentError) do |raised_error|
+ raised_error.should eq my_error
+ end
+ end
+ end
+ """
+ When I run "rspec ./expect_error_with_block_spec.rb"
+ Then the output should contain "1 example, 0 failures"
+
Please sign in to comment.
Something went wrong with that request. Please try again.