Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rspec 3 #46

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/given/rspec/have_failed_212.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module HaveFailed
class HaveFailedMatcher < RSpec::Matchers::BuiltIn::RaiseError
def matches?(given_proc, negative_expectation = false)
if given_proc.is_a?(::Given::Failure)
super
super(lambda { given_proc.call }, negative_expectation)
else
super(lambda { }, negative_expectation)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/given/failure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
end

describe "raising error" do
Then { expect(failure).to raise_error(StandardError, "Oops") }
Then { expect(failure).to raise_error(StandardError) }
Then { expect(failure).to raise_error }
Then { expect { failure.call }.to raise_error(StandardError, "Oops") }
Then { expect { failure.call }.to raise_error(StandardError) }
Then { expect { failure.call }.to raise_error }
end

describe "== have_failed" do
Expand Down
10 changes: 5 additions & 5 deletions spec/lib/given/have_failed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module HaveFailedSpec
context "with a failure" do
When(:result) { fail CustomError, "Ouch" }

Then { expect(result).to raise_error(CustomError, "Ouch") }
Then { expect { result.call }.to raise_error(CustomError, "Ouch") }
Then { expect(result).to have_failed(CustomError, "Ouch") }
Then { expect(result).to have_raised(CustomError, "Ouch") }

Expand All @@ -23,10 +23,10 @@ module HaveFailedSpec
context "with a standard failure" do
When(:result) { fail "Ouch" }

Then { expect(result).to raise_error(StandardError, "Ouch") }
Then { expect(result).to raise_error(StandardError, /^O/) }
Then { expect(result).to raise_error(StandardError) }
Then { expect(result).to raise_error }
Then { expect { result.call }.to raise_error(StandardError, "Ouch") }
Then { expect { result.call }.to raise_error(StandardError, /^O/) }
Then { expect { result.call }.to raise_error(StandardError) }
Then { expect { result.call }.to raise_error }

Then { expect(result).to have_failed(StandardError, "Ouch") }
Then { expect(result).to have_failed(StandardError, /^O/) }
Expand Down