Use with_request_url with query params in specs
Support for query params in component specs was added in ViewComponent 2.41.0.
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe Users::PublicActivityComponent, controller: UsersController do
|
describe Users::PublicActivityComponent, controller: UsersController do
|
||||||
|
include Rails.application.routes.url_helpers
|
||||||
|
|
||||||
around do |example|
|
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
|
end
|
||||||
|
|
||||||
describe "follows tab" do
|
describe "follows tab" do
|
||||||
@@ -28,13 +30,14 @@ describe Users::PublicActivityComponent, controller: UsersController do
|
|||||||
|
|
||||||
it "is the active tab when the follows filters is selected" do
|
it "is the active tab when the follows filters is selected" do
|
||||||
create(:proposal, author: user, followers: [user])
|
create(:proposal, author: user, followers: [user])
|
||||||
controller.params["filter"] = "follows"
|
|
||||||
|
|
||||||
|
with_request_url user_path(user, filter: "follows") do
|
||||||
render_inline component
|
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
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "public interests is not checked" do
|
context "public interests is not checked" do
|
||||||
let(:user) { create(:user, public_interests: false) }
|
let(:user) { create(:user, public_interests: false) }
|
||||||
|
|||||||
Reference in New Issue
Block a user