I don't understand what I am doing wrong and really need some help. I am trying to just write a simple IntegrationTest for a multitenant site where each account has it's own subdomain.
I followed the instructions here for changing the host in the IntegrationTest, however when I run the test
Minitest::Assertion: Expected response to be a redirect to <http://subdomain1.example.com:3000/login> but was a redirect to <http://www.example.com:3000/>.
Expected "http://subdomain1.example.com:3000/login" to be === "http://www.example.com:3000/".
test/integration/feedback_flow_test.rb:8:in `block in <class:FeedbackFlowTest>'
Finished in 0.26594s
1 tests, 2 assertions, 1 failures, 0 errors, 0 skips
I edited my host file so that I have subdomain1.example.com
and www.example.com
pointing to 127.0.0.1. Is there something else that I should be doing to get this to work? Below is the code for the IntegrationTest
require 'test_helper'
class FeedbackFlowTest < ActionDispatch::IntegrationTest
test "no token should go to the login page" do
host! 'subdomain1.example.com:3000'
get feedback_path
assert_redirected_to login_url
follow_redirect!
assert_select '.alert-danger h3', 'You are not authorized '
end
end