I want my users to execute
POST /controllername/v1 { "p2":"v2", "p3":"v3" }
and have POST reach the controller "controllername" as
params={ :p2 => "v2", :p3 => "v3" } p1=v1
Or, in fact, I can work with any other controller appearance; the fact is that the last word in the URL ("v1") should be available to the controller for use in approximately the same way as p2 / v2 and p3 / v3.
And I need to check this with Rpec. In particular:
rspec 2.6.4 rails 3.0.9 ruby 1.9.2
I am using the route
match '/controllername/:p1' => 'controllername#create'
And this rspec rule works:
it 'should route to :create' do assert_routing({ :path => '/controllername/foofoo', :method => :post }, { :controller => "controllername", :action => 'create', :p1 => 'foofoo' }) end
But I canβt figure out how to send a message (from the controller specification). None of these works:
post :create, parameters post :create, parameters, 'foofoo' post :create, parameters, :p1 => 'foofoo' post :create, :p1 => 'foofoo', parameters