Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update throw_symbol specs to go through matcher method

- ensures that matcher method properly delegates both arguments to
  initializer
  • Loading branch information...
commit 5ead0ae6aa610594c6a24162d992b7ac6e25b362 1 parent 2d92689
David Chelimsky dchelimsky authored
4 lib/rspec/matchers/throw_symbol.rb
View
@@ -97,8 +97,8 @@ def args
# lambda { do_something_risky }.should_not throw_symbol
# lambda { do_something_risky }.should_not throw_symbol(:that_was_risky)
# lambda { do_something_risky }.should_not throw_symbol(:that_was_risky, culprit)
- def throw_symbol(sym=nil)
- Matchers::ThrowSymbol.new(sym)
+ def throw_symbol(expected_symbol = nil, expected_arg=nil)
+ Matchers::ThrowSymbol.new(expected_symbol, expected_arg)
end
end
end
6 spec/rspec/matchers/throw_symbol_spec.rb
View
@@ -4,7 +4,7 @@ module RSpec
module Matchers
describe ThrowSymbol do
describe "with no args" do
- before(:each) { @matcher = ThrowSymbol.new }
+ before(:each) { @matcher = throw_symbol }
it "matches if any Symbol is thrown" do
@matcher.matches?(lambda{ throw :sym }).should be_true
@@ -26,7 +26,7 @@ module Matchers
end
describe "with a symbol" do
- before(:each) { @matcher = ThrowSymbol.new(:sym) }
+ before(:each) { @matcher = throw_symbol(:sym) }
it "matches if correct Symbol is thrown" do
@matcher.matches?(lambda{ throw :sym }).should be_true
@@ -58,7 +58,7 @@ module Matchers
end
describe "with a symbol and an arg" do
- before(:each) { @matcher = ThrowSymbol.new(:sym, "a") }
+ before(:each) { @matcher = throw_symbol(:sym, "a") }
it "matches if correct Symbol and args are thrown" do
@matcher.matches?(lambda{ throw :sym, "a" }).should be_true
Please sign in to comment.
Something went wrong with that request. Please try again.