Sha256: 9755415827d5cfee0ff42164b420ccbefc86ea121c1d94156e1c8628606f8ac8
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Shippinglogic Proxy" do it "should initialize with a single target argument" do lambda{ Shippinglogic::Proxy.new }.should raise_error(ArgumentError) lambda{ Shippinglogic::Proxy.new(nil) }.should_not raise_error(ArgumentError) end it "should return the proxy class via the real_class method" do proxy = Shippinglogic::Proxy.new(nil) proxy.real_class.should == Shippinglogic::Proxy end it "should preserve the send method" do proxy = Shippinglogic::Proxy.new(nil) proxy.send(:real_class).should == proxy.real_class end it "should preserve the double-underscore methods" do target = "TARGET" proxy = Shippinglogic::Proxy.new(target) proxy.__id__.should_not == target.__id__ proxy.__send__(:real_class).should == proxy.real_class end it "should preserve the object_id method" do target = "TARGET" proxy = Shippinglogic::Proxy.new(target) proxy.object_id.should_not == target.object_id end it "should delegate all other methods to the target" do target = " Target " proxy = Shippinglogic::Proxy.new(target) methods = [:size, :upcase, :downcase, :strip] methods.each do |method| target.should_receive(method).twice proxy.send(method).should == target.send(method) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shippinglogic-1.2.3 | spec/proxy_spec.rb |