Hello, Can I test in the spec the route taken by the redirect_to from the controller? The URL is not controller/action. I tried: route_for(:controller => "signup", :action => "confirmation").should ="/my/set/URL" but no it absolutely wants: ...should ="signup/confirmation" So how can I test my real URL? Thank you, Anita. -- Posted via http://www.ruby-forum.com/.
Look at the below, I think it entails what you want:
describe YourController do
it "redirects to the home page" do
get :index
response.should redirect_to("your_path_here")
end
end
Zach
On Wed, Oct 8, 2008 at 5:41 PM, Anita Anita <lists at ruby-forum.com>
wrote:> Hello,
>
> Can I test in the spec the route taken by the redirect_to from the
> controller? The URL is not controller/action.
> I tried:
> route_for(:controller => "signup", :action =>
"confirmation").should => "/my/set/URL" but no it
absolutely wants: ...should => "signup/confirmation"
> So how can I test my real URL?
>
> Thank you,
> Anita.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
On Oct 8, 2008, at 5:41 PM, Anita Anita wrote:> Hello, > > Can I test in the spec the route taken by the redirect_to from the > controller? The URL is not controller/action. > I tried: > route_for(:controller => "signup", :action => "confirmation").should > => "/my/set/URL" but no it absolutely wants: ...should => "signup/confirmation" > So how can I test my real URL?There may be a more straightforward way, but params_from may help: http://rspec.info/rdoc-rails/classes/Spec/Rails/Example/ControllerExampleGroup.html#M000066 Scott