Permalink
Browse files

Took advantage of RSpec's should_receive capabilities when testing Pr…

…oxy method delegation.
  • Loading branch information...
1 parent 3e26406 commit 67971334fd42a0889e07771dfb62ec71e4aedcb2 @laserlemon laserlemon committed with binarylogic Jun 1, 2010
Showing with 7 additions and 3 deletions.
  1. +7 −3 spec/proxy_spec.rb
View
@@ -30,9 +30,13 @@
end
it "should delegate all other methods to the target" do
- target = ["TESTING", 1, 2, 3]
+ target = " Target "
proxy = Shippinglogic::Proxy.new(target)
- proxy.class.should == target.class
- proxy.size.should == target.size
+ methods = [:size, :upcase, :downcase, :strip]
+
+ methods.each do |method|
+ target.should_receive(method).twice
+ proxy.send(method).should == target.send(method)
+ end
end
end

0 comments on commit 6797133

Please sign in to comment.