Question: I defined a custom action as a subclass of `ailsAdmin::Config::Actions::Base`. Under the action I defined a `custom controller` - `register_instance_option :controller`

The controller goes through and deletes certain corrupted records and seemed to work fine from my tests. If this was a normal controller I would have written a controller `spec` for this `controller`, but I don't know how to write `specs` for custom `rails_admin` `actions` like this.

I took a look at the `spec` in the `rails_admin repository` but it doesn't seem to help me much: <https://github.com/sferik/rails_admin/blob/master/spec/rails_admin/config/actions/base_spec.rb>

I would like to do a normal `controller spec` where I test posting to the endpoint and then see if a method is called on `an object`, which the link isn't seeming to do. I couldn't seem to find any useful posts online about using `Rspec` with custom `rails_admin actions`.

Answer: 
Here is my setup:

```
RSpec.describe RailsAdmin::MainController, type: :controller do
 routes { RailsAdmin::Engine.routes }

 describe '#my_custom' do
   subject { get :my_custom, { model_name: 'my_model', id: my_model.id } }

   it "should respond with 302" do
     expect(response.code).to eq("302")
   end
 end
end

```
I got someone to help me with this. The controller can be tested like so:

```
describe RailsAdmin::MainController, :type => :controller do

```

but alone I was having routing issues, even when I added Rails Admin URL helpers to spec\_helper.rb. The trick is that when hitting the controller you have to do it like so:

```
post :custom_rails_admin_route, { :use_route  => :rails_admin }

```

Tada!