I have seen some examples of this error, and tried a lot of things but none of them work for me.
Test in Rspec:
it "should load data of invoices" do
post :Invoices , taxiNo: "T2"
expect(response.status).to eq(201)
end
Routes:
post "/Invoices", :to => "taxidriver#getInvoices"
Controller:
class TaxidriverController < ApplicationController
def getInvoices
render :text => {:message => "A new Taxi created"}.to_json, :status => :created
end
end
I am not sure about the line post :Invoices , taxiNo: "T2"
Should I hit the url ? or should I hit the method?
I also tried post :getInvoices, taxiNo: "T2" but still the same error:
ActionController::UrlGenerationError:
No route matches {:action=>"Invoices", :controller=>"bookings", :taxiNo=>"T2"}
# ./spec/controllers/bookings_spec.rb:50:in `block (3 levels) in <top (required)>'
{:action=>"someaction", :controller=>"yourcontroller"}could you post the whole error message? - Norly Canariaspost :getInvoices, taxiNo: "T2". - Norly Canariasget_invoicesand dopost :get_invoices, taxiNo: 'T2'- vutran