Forum: RSpec Re: what's the different between ( [@weather]) and (@weather)?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Andrea J. (Guest)
on 2009-03-26 09:46
(Received via mailing list)

Weather.find(1) returns an object: @weather
Weather.find(:all) returns an array of objects : [@weather]

look at the api of ActiveRecordBase.

You have not specified a parameter for the find method here, so you
expect, that
the find methods you are using, will all return an array of objects.

In the spec you can also define the expected parameters:

Weather.stub!(:find).with(*:all*,* :order* =>

*Von:* "Zhenning G." <removed_email_address@domain.invalid>
*Gesendet:* 26.03.09 07:54:56
*An:* removed_email_address@domain.invalid
*Betreff:* [rspec-users] what's the different between ([@weather]) and

before do
@weather = mock_model(Weather)

I saw this code on peepcode, but I'm a little confused the
mostly, we just and_return(@weather), don't we? so, what is the meaning
of and_return([@weather]) ?
Posted via
rspec-users mailing list

Verschicken Sie SMS direkt vom Postfach aus - in alle deutschen und
ausländische Netze zum gleichen Preis!
This topic is locked and can not be replied to.