Ruby is a permissive language. There are myriad cases in which you throw unintended arguments at methods and they just work, especially when they're just used as parts of Strings. So, while a constant isn't the intent, as long as it has a useful to_s implementation, there's no reason it won't work.
On Tue, Nov 6, 2012 at 1:06 AM, beagile <[email protected]> wrote: > Great. What confused me in the beginning was that I could use a constant > as first argument, too... Good to see this clarified in the docs. > > Am Dienstag, 6. November 2012 04:07:09 UTC+1 schrieb [email protected]: >> >> FYI - I updated the docs here: http://rubydoc.info/** >> github/rspec/rspec-mocks/**RSpec/Mocks/ExampleMethods#** >> double-instance_method<http://rubydoc.info/github/rspec/rspec-mocks/RSpec/Mocks/ExampleMethods#double-instance_method> >> >> Won't make it to http://rubydoc.info/gems/**rspec-mocks/RSpec/Mocks/** >> ExampleMethods#double-**instance_method<http://rubydoc.info/gems/rspec-mocks/RSpec/Mocks/ExampleMethods#double-instance_method> >> until >> the next release, but that should be coming soon. >> >> Cheers, >> David >> >> On Monday, November 5, 2012 8:15:00 AM UTC-6, [email protected] wrote: >> >>> The first arg is used for documentation/reporting purposes, that's all. >>> Doesn't matter if it's a Symbol or String. If it's not there you'll just >>> see "mock" in the output without any clarification of which mock failed. >>> >>> This is admittedly not explained perfectly clearly on >>> http://rubydoc.info/gems/**rspec-mocks/RSpec/Mocks/** >>> ExampleMethods#double-**instance_method<http://rubydoc.info/gems/rspec-mocks/RSpec/Mocks/ExampleMethods#double-instance_method>, >>> so we'll improve that doc. >>> >>> Cheers, >>> David >>> >>> >>> On Mon, Nov 5, 2012 at 7:48 AM, beagile <[email protected]> wrote: >>> >>>> Couldn't find a clue in the rspec-mocks documentation what the >>>> difference is... The documentation always uses the mock('some')-variant. >>>> So is there a difference and if then what exactly? >>>> >>>> Govinda >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "rspec" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to rspec+un...@** >>>> googlegroups.com. >>>> >>>> To view this discussion on the web visit https://groups.google.com/d/** >>>> msg/rspec/-/CwM_iJzzXFoJ<https://groups.google.com/d/msg/rspec/-/CwM_iJzzXFoJ> >>>> . >>>> For more options, visit >>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>>> >>>> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msg/rspec/-/L4gsTYGSG2AJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
