Skip to content

Commit

Permalink
Took advantage of RSpec's should_receive capabilities when testing Pr…
Browse files Browse the repository at this point in the history
…oxy method delegation.
  • Loading branch information
laserlemon authored and binarylogic committed Aug 21, 2010
1 parent 3e26406 commit 6797133
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions spec/proxy_spec.rb
Expand Up @@ -30,9 +30,13 @@
end end


it "should delegate all other methods to the target" do it "should delegate all other methods to the target" do
target = ["TESTING", 1, 2, 3] target = " Target "
proxy = Shippinglogic::Proxy.new(target) proxy = Shippinglogic::Proxy.new(target)
proxy.class.should == target.class methods = [:size, :upcase, :downcase, :strip]
proxy.size.should == target.size
methods.each do |method|
target.should_receive(method).twice
proxy.send(method).should == target.send(method)
end
end end
end end

0 comments on commit 6797133

Please sign in to comment.