This project is archived and is in readonly mode.
undefined method `server_name' for #<ActionController::TestRequest
-
Patrick
- Assigned user set to Frederick Cheung
-
Roger
I assume that this is for a "related" database [connected] and should work [and normally does?]
-
Frederick Cheung
the server_name method just isn't defined on the fake requests that passed in. It should be hard to add this, similar to how user_agent or host are set (in test_process.rb).
Alternatively you could always stick
def setup def @request.server_name "foo.bar" end endin the relevant test cases
-
Patrick
Thanks for getting back to me, I appreciate it.
Yes, it works fine outside the normal "testing" context.
Regarding Fredricks's response. I thought I tried that inside my functional test, but still received the error. Let me try it again though.
-
Patrick
The other thing is that this test is relevant in all my test cases, but let me try the work around out again.
-
Patrick
I still get the same error:
NoMethodError: undefined method server_name' for <ActionController::TestRequest
when defining
def setup def @request.server_name
"127.0.0.1"end end
in the test case specifically.
-
Patrick
Any other recommendations for this one?
-
Pratik
- State changed from new to incomplete
Is this still an issue on edge ? A failing test case would be great ! http://guides.rails.info/contrib... should be helpful.
Thanks
-
Ryan Bigg
- State changed from incomplete to invalid
This is working on 2.3.5 and latest Rails for me.