Use with_request_url in component specs

This method is available since view component 2.31.0, and greatly
simplifies tests depending on the current URL.
This commit is contained in:
Javi Martín
2021-08-12 22:50:40 +02:00
parent 474dd09f90
commit 5f19d73b40
4 changed files with 8 additions and 10 deletions

View File

@@ -7,7 +7,10 @@ describe Budgets::Investments::FormComponent, type: :component do
before do
allow(controller).to receive(:current_user).and_return(create(:user))
allow(request).to receive(:path_parameters).and_return(budget_id: budget.id)
end
around do |example|
with_request_url(new_budget_investment_path(budget)) { example.run }
end
describe "accept terms of services field" do