From 15d9b88978c76bafb7b2773f06e1000b8b3672f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 4 Mar 2022 12:45:51 +0100 Subject: [PATCH] Use with_request_url with query params in specs Support for query params in component specs was added in ViewComponent 2.41.0. --- .../users/public_activity_component_spec.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spec/components/users/public_activity_component_spec.rb b/spec/components/users/public_activity_component_spec.rb index 2f72c8495..7f066903f 100644 --- a/spec/components/users/public_activity_component_spec.rb +++ b/spec/components/users/public_activity_component_spec.rb @@ -1,8 +1,10 @@ require "rails_helper" describe Users::PublicActivityComponent, controller: UsersController do + include Rails.application.routes.url_helpers + around do |example| - with_request_url(Rails.application.routes.url_helpers.user_path(user)) { example.run } + with_request_url(user_path(user)) { example.run } end describe "follows tab" do @@ -28,11 +30,12 @@ describe Users::PublicActivityComponent, controller: UsersController do it "is the active tab when the follows filters is selected" do create(:proposal, author: user, followers: [user]) - controller.params["filter"] = "follows" - render_inline component + with_request_url user_path(user, filter: "follows") do + render_inline component - expect(page).to have_selector "li.is-active", text: "1 Following" + expect(page).to have_selector "li.is-active", text: "1 Following" + end end end