[rspec-users] get_via_redirect in controller specs

David Chelimsky dchelimsky at gmail.com
Tue May 26 09:53:01 EDT 2009


On Tue, May 26, 2009 at 9:42 AM, Andrew Premdas <apremdas at gmail.com> wrote:
> Want to do the following in my controller spec
> describe CheckoutController, "handling stale session" do
>
>   before do
>    session[:order_id] = 5
>    Order.delete_all
>  end
>
>  it "should not throw a 404" do
>    get_via_direct :index
>  end
> Getting the following error message,
> NoMethodError in 'CheckoutController handling stale session should not throw
> a 404'
> undefined method `get_via_redirect' for
> #<Spec::Rails::Example::ControllerExampleGroup::Subclass_1:0x21cc080>
>
> not sure why I can call 'get' and 'put' but can't call this method

get_via_direct is available in ActionController::IntegrationTest, not
ActionController::TestCase, which is what is wrapped by controller
specs.

HTH,
David

>
>
> Rails 2.3.2
> RSpec 1.2.6
> TIA
> Andrew
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list