Permalink
Browse files

Update throw_symbol specs to use method instead of matcher

[#1040 state:resolved]
  • Loading branch information...
1 parent 4e42338 commit dd0b4d34bc7072fffcd96cff4a44e60fb3244756 @dchelimsky dchelimsky committed Aug 21, 2010
Showing with 9 additions and 5 deletions.
  1. +4 −0 example_spec.rb
  2. +2 −2 lib/spec/matchers/throw_symbol.rb
  3. +3 −3 spec/spec/matchers/throw_symbol_spec.rb
View
@@ -0,0 +1,4 @@
+context 'foo' do
+ subject { [] }
+ its(:size) { should == 1 }
+end
@@ -93,8 +93,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
@@ -4,7 +4,7 @@ module Spec
module Matchers
describe ThrowSymbol do
describe "with no args" do
- let(:matcher) { ThrowSymbol.new }
+ let(:matcher) { throw_symbol }
it "matches if any Symbol is thrown" do
matcher.matches?(lambda{ throw :sym }).should be_true
@@ -30,7 +30,7 @@ module Matchers
end
describe "with a symbol" do
- let(:matcher) { ThrowSymbol.new(:sym) }
+ let(:matcher) { throw_symbol(:sym) }
it "matches if correct Symbol is thrown" do
matcher.matches?(lambda{ throw :sym }).should be_true
@@ -75,7 +75,7 @@ module Matchers
end
describe "with a symbol and an arg" do
- let(:matcher) { ThrowSymbol.new(:sym, "a") }
+ let(:matcher) { throw_symbol(:sym, "a") }
it "matches if correct Symbol and args are thrown" do
matcher.matches?(lambda{ throw :sym, "a" }).should be_true

0 comments on commit dd0b4d3

Please sign in to comment.