public
Last active

  • Download Gist
gistfile1.rbx
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
irb~ $ irb
>> require 'rubygems'
=> false
>> require 'rr'
=> true
>> extend RR::Adapters::RRMethods
=> main
>> mock(o = Object.new).foo.mock.bar { 'hi' }
=> #<RR::DoubleDefinition:0x22b7cb0 @block_callback_strategy=:returns, @yields_value=nil, @implementation=#<Proc:0x022bbba8@(irb):4>, after_call_valuenil, double#<RR::Double:0x22b7c88 @times_called_expectation=#<RR::Expectations::TimesCalledExpectation:0x22b6f04 @verify_backtrace=["/usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double.rb:26:in `initialize'", "/usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_definition_creator.rb:88:in `new'", "/usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_definition_creator.rb:88:in `setup_double'", "/usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_definition_creator.rb:59:in `create'", "/usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_definition_creator_proxy.rb:14:in `method_missing'", "(irb):4:in `irb_binding'", "/usr/local/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'", "/usr/local/lib/ruby/1.8/irb/workspace.rb:52"], @matcher=nil, @double=#<RR::Double:0x22b7c88 ...>, times_called0, definition#<RR::DoubleDefinition:0x22b7cb0 ..., @times_called=0, @double_injection=#<RR::DoubleInjection:0x22b8548 @method_name=:bar, @doubles=[#<RR::Double:0x22b7c88 ...>], object#<Object:0x22b940c, @times_matcher=#<RR::TimesCalledMatchers::IntegerMatcher:0x22b6d9c @times=1>, creator_proxy#<RR::DoubleDefinition:0x22b60b8, @argument_expectation=#<RR::Expectations::ArgumentEqualityExpectation:0x22b6db0 @expected_arguments=[]>
>> o.foo.bar
=> "hi"
>> o.foo.bar
RR::Errors::TimesCalledError: foo()
Called 2 times.
Expected 1 times.
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/expectations/times_called_expectation.rb:47:in `verify_input_error'
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/expectations/times_called_expectation.rb:20:in `attempt'
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double.rb:238:in `call'
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_injection.rb:82:in `call_method'
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_injection.rb:76:in `__send__'
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_injection.rb:76:in `__rr__foo'
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_injection.rb:37:in `__send__'
from /usr/local/lib/ruby/gems/1.8/gems/rr-0.5.0/lib/rr/double_injection.rb:37:in `foo'
from (irb):6
>>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.