I tried a lot of options @request.host
, host!
and post path, args, {'SERVER_NAME' => my_secret_domain}
without success, both in controller tests and in function tests. Very aggravating, as many others have reported success with these approaches.
The solution for me was:
request.headers["SERVER_NAME"] = my_secret_domain post path, args
I am running ruby 2.1.5p273, rspec 3.1.7 and Rails 4.2.0
source share