Files
nairobi/spec/components/admin/roles/table_actions_component_spec.rb
Javi Martín c66a5a30ef Allow using table actions in different namespaces
This way we can reuse it in sections like SDGManagement and URLs will be
automatically generated as expected.
2021-01-14 17:35:38 +01:00

22 lines
677 B
Ruby

require "rails_helper"
describe Admin::Roles::TableActionsComponent, type: :component do
let(:user) { create(:user) }
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("Admin::BaseController")
end
it "renders link to add the role for new records" do
render_inline Admin::Roles::TableActionsComponent.new(user.build_manager)
expect(page).to have_css "a[data-method='post']", text: "Add"
end
it "renders link to remove the role for existing records" do
render_inline Admin::Roles::TableActionsComponent.new(create(:manager, user: user))
expect(page).to have_css "a[data-method='delete']", text: "Delete"
end
end