[rspec-users] [rspec] How to pass route parameters to post method?

Evgeny Bogdanov evgeny.bogdanov at gmail.com
Fri Jun 5 08:55:55 EDT 2009


Hello Mike,

Thank you for your hint. Obviously, it worked!
Laughing at myself now: how post method was supposed to know what I
mean by :viewtype if don't specify it :)

Best,
Evgeny

On Jun 4, 10:14 pm, Mike Sassak <msas... at gmail.com> wrote:
> Hi Evgeny,
>
> You didn't include the error message in your email, so this is just a guess,
> but from your example, it looks like you need to specify :viewtype in your
> call to post, like so:
>
> post :create, :viewtype => 'context'
>
> The HTTP verb methods require you to specify the route parameters in order
> to work.
>
> Mike
>
> On Jun 2, 2009 3:53 AM, "Evgeny Bogdanov" <evgeny.bogda... at gmail.com> wrote:
>
> Hello,
>
> I am trying to spec an action in a controller, and rspec doesn't find
> a route.
> It seems that problem is in ":viewtype". If I change a line
> "/:viewtype/asset/add"
> into "/context/asset/add" in routes it works.
>
> I tried also
> post "/context/asset/add", no luck.
>
> Could you please let me know how I can call the action through
> that route with post method?
>
> Thank you in advance,
> Evgeny
> =====================
>  map.with_options(:controller => "assets", :conditions =>{:method
> => :post}) do |m|
>    m.create_asset                   '/:viewtype/asset/
> add',                        :action => 'create'
>  end
>
> describe AssetsController, "when working with formats" do
>  it "should call a find_asset_format for some actions" do
>    post :create
>  end
> end
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list