Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add host option to with_request_url test helper #1773

Conversation

pbstriker38
Copy link
Contributor

  • This allows testing components that use path helpers that are constrained by a subdomain in routes.rb.

What are you trying to accomplish?

We have routes that are constrained by a subdomain in our routes file. If the requests host does not match the constraint then a ActionController::RoutingError: No route matches "..." is raised.

config/routes.rb

Rails.application.routes.draw do
  constraints subdomain: 'app' do
    resources: :products
  end
end

@pbstriker38 pbstriker38 force-pushed the allow_setting_host_on_with_request_url branch from 0b151a5 to 1ddb5fa Compare June 15, 2023 16:21
- This allows testing components that use path helpers that are
 constrained by a subdomain in routes.rb.
@pbstriker38 pbstriker38 force-pushed the allow_setting_host_on_with_request_url branch from 1ddb5fa to 5b0f3b8 Compare June 15, 2023 16:25
Copy link
Member

@joelhawksley joelhawksley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏻 thanks for the clean PR!

@joelhawksley joelhawksley enabled auto-merge (squash) June 15, 2023 17:42
@joelhawksley joelhawksley merged commit 5decd07 into ViewComponent:main Jun 15, 2023
@pbstriker38 pbstriker38 deleted the allow_setting_host_on_with_request_url branch June 15, 2023 18:26
claudiob pushed a commit to claudiob/view_component that referenced this pull request Dec 22, 2023
- This allows testing components that use path helpers that are
 constrained by a subdomain in routes.rb.
claudiob pushed a commit to claudiob/view_component that referenced this pull request Jan 3, 2024
- This allows testing components that use path helpers that are
 constrained by a subdomain in routes.rb.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants