[FYI] issues with integration testing


#1

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


#2

Chris,

Please do submit a ticket for this. Thanks!

  • Jamis