Skip to content

Instantly share code, notes, and snippets.

@renaehodgkins
Last active August 29, 2015 13:57
Show Gist options
  • Save renaehodgkins/9367955 to your computer and use it in GitHub Desktop.
Save renaehodgkins/9367955 to your computer and use it in GitHub Desktop.
testing activeadmin controller example
require 'spec_helper'
describe Admin::ArtifactsController, type: feature do
render_views
before(:each) do
@user = create(:user)
@admin_user = AdminUser.create(email: "test123@test.com", password: "123SuperTest")
@artifact = create(:artifact)
end
describe "Artifact index" do
before(:each) do
@artifact.request_digitization(@user)
end
it "shows the artifact in the index" do
visit admin_artifacts_path
fill_in 'admin_user_email', :with => @admin_user.email
fill_in 'admin_user_password', :with => @admin_user.password
click_button 'Login'
expect(page).to have_content(@artifact.solr_document_id)
end
end
end
@renaehodgkins
Copy link
Author

Might be helpful to note that the spec is placed in the spec/controllers/admin/ directory

@PaulOstazeski
Copy link

I think it isn't showing up highlighted (and with 8-space indentation) b/c github can't tell it's a ruby file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment