I have written an engine:
module MercatorMpay24
class Admin::PaymentsController < ::Admin::AdminSiteController
def check_confirmation
@payment = Payment.find(params[:id])
end
end
end
and defined a route:
MercatorMpay24::Engine.routes.draw do
namespace :admin do
get 'payments/:id/check_confirmation' => 'payments#check_confirmation',
:as => 'check_confirmation'
end
end
that works fine and can be called, responds, ...
Now I want to unit test that:
require 'spec_helper'
describe MercatorMpay24::Admin::PaymentsController, :type => :controller do
describe "GET #check_confirmation" do
it "finds the payment" do
@payment = create(:payment)
get :check_confirmation, id: @payment.id
expect(assigns(:payment)).to eql @payment
end
end
end
but that gives me an 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 GET /admin/payments/:id/check_confirmation(.:format)
mercator_mpay24/admin/payments#check_confirmation
I guess, I'm doing something wrong with namespaces here, but I have no clue, what ....
I was missing:
in the controller spec.