Reputation: 1
In my Rails application, ruby 2.6.5, rails 6.1. I use Active admin and I created this page. How can I create some tests for this using rspec? I have already created tests for the model and the controller.
ActiveAdmin.register BxBlockTermsAndConditions::TermsAndCondition, as: "TermsAndConditions" do
permit_params :description, :account_id
index do
selectable_column
id_column
column :account_id
column :description
column :created_at
column :updated_at
actions
end
form do |f|
f.inputs do
f.input :account_id, label: "Conta"
f.input :description
end
f.actions
end
show do
attributes_table do
row :id
row :account_id
row :description
row :created_at
row :updated_at
end
end
end
Someone can help me?
How to test the page
Upvotes: -2
Views: 43
Reputation: 4596
It's a normal request spec. For example, if you want to test the index action
RSpec.describe Admin::TermsAndConditionsController, type: :request do
let(:admin_user) { create(:admin_user) }
before { sign_in admin_user }
describe "GET" do
it 'index returns http success' do
get main_app.admin_terms_and_conditions_path
expect(response).to be_successful
end
end
end
Check your rails/routes
to be sure about the path
Upvotes: 1