[rspec-users] Using the response object in stories

Juanma Cervera lists at ruby-forum.com
Tue Sep 30 10:25:50 EDT 2008

I have this statement in the layout of my application (using haml)

- if request.env["HTTP_USER_AGENT"].include?("MSIE")
 = stylesheet_link_tag 'blueprint/ie.css'
 = stylesheet_link_tag 'confirm_ie.css'

The problem is that request.env["HTTP_USER_AGENT"] is nil when I go to
some page in the features I write with cucumber and webrat

This is the error I get
      You have a nil object when you didn't expect it!
      You might have expected an instance of Array.
      The error occurred while evaluating nil.include?
      On line #23 of layouts/application.html.haml

¿How can I stub these methods for the reponse object?

Juan M. Cervera
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list