Forum: RSpec Re: resource urls only work *after* a get() in controller spec

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
942a74b1b71ca62234ae690b44699ebc?d=identicon&s=25 unknown (Guest)
on 2009-02-02 07:43
(Received via mailing list)
Okay, following up on this item.  Would you believe a workaround of
(gasp) get :index, prior to expecting route-based URLs to work?  (slaps
forehead).  or do_action(), provided by the host example group (the
more concrete example group, I mean - what's the right terminology
there?).

I
tried reproducing the stuff I saw being done in
action_controller/test_process.rb up to the point where the resource
url function started working, but when I did that (setting up the
controller name and action, essentially), I wasn't getting it to work,
but I ran out of time budget for fooling with it.

If anyone thinks of a better way, I'm all ears.

Until then,

Randy



----- Original Message ----
Cdf378de2284d8acf137122e541caa28?d=identicon&s=25 Matt Wynne (mattwynne)
on 2009-02-02 09:12
(Received via mailing list)
On 2 Feb 2009, at 06:18, r_j_h_box-sf@yahoo.com wrote:

>
> Okay, following up on this item.  Would you believe a workaround of
> (gasp) get :index, prior to expecting route-based URLs to work?
> (slaps

That's what I was going to suggest. We have all our routing tests in a
separate file (away from the controllers) and this what we do there.

> forehead).  or do_action(), provided by the host example group (the
> more concrete example group, I mean - what's the right terminology
> there?).

This is another approach that can work too. We call it #do_request.

You can override helper methods like this as you go into describe
blocks so you can have a very basic on the outside level and
specialise it as you get into more detail.

>
>>
>> the controller to allow me to call its initialize_current_url to
>> controller actions -
>>
>>> To: rspec-users
>>>> testing, and it makes a callback to the example group that says
>>>>
>>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com
This topic is locked and can not be replied to.