Jeremy Burks
2006-Nov-15 16:23 UTC
[mocha-developer] using expects with [] (for Hash and Array)
First off, thanks for the great library. Is there a way setup expects with this: runtime_options[:property] = properties_option_string or do i have to use: runtime_options.store(:property, properties_option_string) which results in this: runtime_options.expects(:store).with(:property, ''prop1=1'') Thanks for your help. jeremy
Jamie Macey
2006-Nov-15 21:07 UTC
[mocha-developer] using expects with [] (for Hash and Array)
On 11/15/06, Jeremy Burks <jeremy.burks at gmail.com> wrote:> First off, thanks for the great library. > > Is there a way setup expects with this: > > runtime_options[:property] = properties_option_stringThis is probably equivalent to runtime_options.[]=(:property, properties_option_string) in which case, this should work: runtime_options.expects(:[]=).with(:property, properties_option_string) - Jamie
James Mead
2006-Nov-15 22:06 UTC
[mocha-developer] using expects with [] (for Hash and Array)
On 15/11/06, Jeremy Burks <jeremy.burks at gmail.com> wrote:> > First off, thanks for the great library. > > Is there a way setup expects with this: > > runtime_options[:property] = properties_option_string > > or do i have to use: > > runtime_options.store(:property, properties_option_string) > > which results in this: > > runtime_options.expects(:store).with(:property, ''prop1=1'') >[]= is just another method, so you should be able to do something like this... runtime_options.expects(:[]=).with(:property, ''prop1=1'') -- James. http://blog.floehopper.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mocha-developer/attachments/20061115/333f7d32/attachment.html
Jeremy Burks
2006-Nov-15 23:02 UTC
[mocha-developer] using expects with [] (for Hash and Array)
Aahhhh, yes. That makes sense now that i am looking at it. Thanks. jeremy On 11/15/06, James Mead <jamesmead44 at gmail.com> wrote:> On 15/11/06, Jeremy Burks <jeremy.burks at gmail.com> wrote: > > First off, thanks for the great library. > > > > Is there a way setup expects with this: > > > > runtime_options[:property] = properties_option_string > > > > or do i have to use: > > > > runtime_options.store(:property, > properties_option_string) > > > > which results in this: > > > > runtime_options.expects(:store).with(:property, > ''prop1=1'') > > > > []= is just another method, so you should be able to do something like > this... > > runtime_options.expects(:[]=).with(:property, ''prop1=1'') > > -- > James. > http://blog.floehopper.org > _______________________________________________ > mocha-developer mailing list > mocha-developer at rubyforge.org > http://rubyforge.org/mailman/listinfo/mocha-developer > >