-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add a scenario for using subdomain constrained routes #2520
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of notes.
Looks good otherwise, thank you!
headers = { "ACCEPT" => "application/json" } | ||
post "/widgets", :params => { :widget => {:name => "My Widget"} }, :headers => headers | ||
|
||
expect(response.content_type).to eq("application/json; charset=utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you may have noticed, content_type
depends on the Rails version. We have different examples, and they are either run or skipped depending on CI job matrix.
I suggest .to start_with("application/json")
so that this example passes with all Rails versions from our matrix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pirj ,
Thanks for your feedback. I added the requested changes.
However the test without the host!
is still passing, so I wanna look into this again. I will let you know once the PR is ready for review again.
Thanks for taking the time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked on Rails 6 that this fails without host!
Thank you for the contribution! |
Add a scenario for using subdomain constrained routes
Just some documentation on how to use
host!
in before block for testing subdomain constrained requests.Credits for this go to @gferrarocamus for pointing this out, see #789 (comment)