Sha256: 9caac2dd19b82270ae68d5e3f45631a3840a9d8351633f9c1d8bf0ad31690bbe
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
dir = File.dirname(__FILE__) require "#{dir}/../example_helper" module RR describe Double, "#reset", :shared => true do it "cleans up by removing the __rr__ method" do @double.bind @object.methods.should include("__rr__foobar__rr__") @double.reset @object.methods.should_not include("__rr__foobar__rr__") end end describe Double, "#reset when method does not exist" do it_should_behave_like "RR::Double#reset" before do @space = Space.new @object = Object.new @method_name = :foobar @object.methods.should_not include(@method_name.to_s) @double = Double.new(@space, @object, @method_name) end it "removes the method" do @double.bind @object.methods.should include(@method_name.to_s) @double.reset @object.methods.should_not include(@method_name.to_s) proc {@object.foobar}.should raise_error(NoMethodError) end end describe Double, "#reset when method exists" do it_should_behave_like "RR::Double#reset" before do @space = Space.new @object = Object.new @method_name = :foobar def @object.foobar :original_foobar end @object.methods.should include(@method_name.to_s) @original_method = @object.method(@method_name) @double = Double.new(@space, @object, @method_name) end it "removes the method" do @double.bind @object.methods.should include(@method_name.to_s) @double.reset @object.methods.should include(@method_name.to_s) @object.foobar.should == :original_foobar end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rr-0.1.0 | examples/rr/double_reset_example.rb |
rr-0.1.1 | examples/rr/double_reset_example.rb |
rr-0.1.2 | examples/rr/double_reset_example.rb |