routes - Rails 4.0 Engine and nested Routing testing with Rspec 3 -
i have written engine:
module mercatormpay24 class admin::paymentscontroller < ::admin::adminsitecontroller def check_confirmation @payment = payment.find(params[:id]) end end end
and defined route:
mercatormpay24::engine.routes.draw namespace :admin 'payments/:id/check_confirmation' => 'payments#check_confirmation', :as => 'check_confirmation' end end
that works fine , can called, responds, ...
now want unit test that:
require 'spec_helper' describe mercatormpay24::admin::paymentscontroller, :type => :controller describe "get #check_confirmation" "finds payment" @payment = create(:payment) :check_confirmation, id: @payment.id expect(assigns(:payment)).to eql @payment end end end
but gives me error:
no route matches {:action=>"check_confirmation", :controller=>"mercator_mpay24/admin/payments", :id=>"1"}
while rake routes | grep check_confirmation
gives me:
admin_check_confirmation /admin/payments/:id/check_confirmation(.:format) mercator_mpay24/admin/payments#check_confirmation
i guess, i'm doing wrong namespaces here, have no clue, ....
i missing:
routes { mercatormpay24::engine.routes }
in controller spec.
Comments
Post a Comment