btakita / rr

RR (Double Ruby) is a test double framework that features a rich selection of double techniques and a terse syntax.
http://github.com/rr/rr
MIT License
501 stars 58 forks source link

[*foo] idiom fails on ruby 1.9.2 with rr stubs/mocks #61

Open trampoline opened 13 years ago

trampoline commented 13 years ago

using [*foo] idiom to expand a singular-or-array value into an array fails when foo value has a rr stub or mock method

 require 'rr'
 include RR::Adapters::RRMethods
 stub(o).foo{"foo"}
 [*o]

 RR::Errors::DoubleNotFoundError: On subject #<Object:0x00000100860e10>
 ...
trampoline commented 13 years ago

oops : missed the crucial lines of backtrace :

 RR::Errors::DoubleNotFoundError: On subject #<Object:0x00000100860e10>,
 unexpected method invocation:
   to_a()
 expected invocations:

    from /Users/mccraig/.rvm/gems/ruby-1.9.2-p180@general/gems/rr-1.0.2/lib/rr/method_dispatches/base_method_dispatch.rb:76:in `double_not_found_error'
    from /Users/mccraig/.rvm/gems/ruby-1.9.2-p180@general/gems/rr-1.0.2/lib/rr/method_dispatches/method_missing_dispatch.rb:26:in `call'
    from /Users/mccraig/.rvm/gems/ruby-1.9.2-p180@general/gems/rr-1.0.2/lib/rr/injections/method_missing_injection.rb:58:in `method_missing'
    from /Users/mccraig/.rvm/gems/ruby-1.9.2-p180@general/gems/rr-1.0.2/lib/rr/injections/double_injection.rb:129:in `to_a'
    from (irb):10
    from /Users/mccraig/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'