Use with_controller_class in component tests

This feature was introduced in view_component 2.27.0.
This commit is contained in:
Javi Martín
2021-08-10 15:02:01 +02:00
parent 6df7f7d052
commit b4bfe440bd

View File

@@ -80,8 +80,8 @@ RSpec.configure do |config|
sign_in(create(:administrator).user)
end
config.before(:each, :controller, type: :component) do |example|
allow(ViewComponent::Base).to receive(:test_controller).and_return(example.metadata[:controller].to_s)
config.around(:each, :controller, type: :component) do |example|
with_controller_class(example.metadata[:controller]) { example.run }
end
config.before(:each, :show_exceptions) do