Skip to content

Testing your ActiveAdmin resources with RSpec

nhance edited this page Dec 18, 2012 · 2 revisions

ActiveAdmin comes with its own tests, so your testing can be limited to verifying the configuration of your application and resources.

This wiki is a work in progress, but can be used as a reference.

Ensuring a resource exists

ActiveAdmin.application.namespaces[:admin].resources.should have_key("AdminUser")


For the items below, assume the following:

let(:resource_class) { YourResource }
let(:resource)       { ActiveAdmin.application.namespaces[:admin].resources.find_by_class(resource_class) }

Verify resource name

resource.resource_name.should == "YourResource"

Verifying menu display

resource.should be_include_in_menu resource.menu.label.should == "Your Resources"

Verifying defined actions for a resource

resource.defined_actions.should =~ [:create, :new, :update, :edit, :index, :show, :destroy]

Verifying scope

resource.scope_to.should == :current_user

Verifying page details

???

Clone this wiki locally