Simplify changing controllers in component tests

This commit is contained in:
Javi Martín
2021-08-10 14:54:09 +02:00
parent 403bf87744
commit 6df7f7d052
7 changed files with 11 additions and 29 deletions

View File

@@ -1,12 +1,8 @@
require "rails_helper"
describe Admin::Roles::TableActionsComponent, type: :component do
describe Admin::Roles::TableActionsComponent, type: :component, controller: Admin::BaseController 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)