Robert Walker wrote in post #956180:
> Marnen Laibow-Koser wrote in post #956174:
>> Robert Walker wrote in post #956169:
>>> Steve Ross wrote in post #956143:
>>>> On Oct 20, 2010, at 11:34 PM, Ishit Parikh wrote:
>>>>
>>>>> I want test case in rspec for:
>>>>> @drugs = Drug.where('drug_category_id = ?', params[:id])
>>>
>>> Assuming this line is in a controller action...
>>
>> ...then you shouldn't be writing RSpec specs for it at all. Use
>> Cucumber instead.
>
> Agreed, but the OP asked about RSpec, so I showed an RSpec example.
OK, fair enough.
[...]
> Agreed, but was attempting to show "pure" RSpec rather than RSpec plus
> something else. Also, as you said using mocks can take more setup,
Yeah, to the point where I think they're more trouble than they're
worth, and may actually be dangerous for AR models.
> but
> they can also provide a performance boost for specs that don't actually
> require hitting a database. I'll have to put some more thought in to
> using an in-memory database for testing. That's intriguing.
The idea is not original with me (I'm not such a performance weenie that
I'd think of that myself :) ). SQLite can operate in in-memory mode,
which I think is where the idea came from.
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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 this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.