Forum: Ruby on Rails [FYI] issues with integration testing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (Guest)
on 2006-04-07 19:21
(Received via mailing list)
I was working on an integration test to test login/logout functionality
and
came across an issue that took me a bit to figure out.

In one of my controllers, I have to test the
request.env["HTTP_USER_AGENT"]
value as a portion of the app will be access by Windows CE hand-helds.
in
the controllers index action i had the lines

logger.info "user agent: " + request.env["HTTP_USER_AGENT"]
redirect_to :controller => "handheld", :action => "index" and return if
request.env["HTTP_USER_AGENT"] =~ /Windows CE/


my test was failing due to a 500 server status, as a 200 was expected

well, after some figuring out how to get at the response to see why I
was
getting a 500 status response

(i wound up doing a puts @response.body...if there is a cleaner way,
please
tell me)

i saw that i was getting a can't convert nil to string error in the
index
method....hmmm

i removed the first line and suddenly my test worked.

after inspecting @request.env, i see there is no HTTP_USER_AGENT entry
in
the hash.

so this is just an FYI for those that might run across this.

and to anyone who's involved in the development of the integration test
code...should I put a ticket in for something like this?

Chris
992fe8c19bbbc27f2b562a9f96efc03d?d=identicon&s=25 Jamis Buck (Guest)
on 2006-04-09 03:08
(Received via mailing list)
Chris,

Please do submit a ticket for this. Thanks!

- Jamis
This topic is locked and can not be replied to.