In my Rails 3 app, I have different layouts for iPhone vs desktop browsers. I\'m trying to test the iPhone layout using Cucumber/Capybara. So far, all my attempts at setting
Had to fiddle a bit on this, but in the end I managed to get it working just by adding:
# features/support/capybara_headers.rb:
module CapybaraHeadersHelper
def add_headers(headers)
headers.each do |name, value|
page.driver.browser.header(name, value)
end
end
end
World(CapybaraHeadersHelper)
You can get more info in this blog post I wrote, but that's basically it.
Hey there. Glad you found my post ;-)
Did you check if Rack::Test
passes your header to the controller?
You could try something like Rails.logger.info("Headers: #{headers.inspect}")
in your controller and then inspect your log file.