Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7785949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:20:15+00:00 2026-06-01T20:20:15+00:00

I have some functionality in a rails 3.2 app that needs to be driven

  • 0

I have some functionality in a rails 3.2 app that needs to be driven by the user’s USER_AGENT. Basically, for certain older browsers I need to have the pages render differently.

How can I test that my views respond correctly using using capybara / cucumber?

I saw this post but it doesn’t look like it works with the lastest capybara — it basically hacks the way capybara stubs environmental parameters:

http://blog.sparqcode.com/2011/03/07/custom-user-agent-strings-with-cucumber-and-capybara/

What I’d like is a cucumber step definition that looks something like this:

When /^I visit the page with an unsupported browser$/ do
  user_agent = "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.2) Gecko/2008092313 Ubuntu/9.25 (jaunty) Firefox/3.8"
  # do something here that mimics the user arriving on the page with this USER_AGENT
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:20:16+00:00Added an answer on June 1, 2026 at 8:20 pm

    If you’re using Firefox to run your tests, you can create a custom driver with whatever USER_AGENT you like. See this answer.

    Once you’ve created a custom driver, you can use it when running a scenario simply by tagging the scenario with the drivers name, e.g if you do Capybara.register_driver :old_browser, you can tag the scenario as @old_browser, and Capybara will automatically switch drivers. If you don’t like that, you can switch drivers at any time you like: Capybara.current_driver = :old_browser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails app that has some simple functionality, allowing the user to
I have some functionality that needs to be async in my C# app. It's
I have some functionality that I need in all my classes which derive from
Many mobile web browsers have some default functionality on image hold. For example, user
I'm wanting to add some AJAX functionality to my Rails app, but have no
I have a rails app that uses Sunspot and Solr for search functionality. I'm
Let's say I have a Rails app that gets most of it's functionality from
I have an existing Rails internal app, that handles inventory, invoicing, order taking, labeling,
I'm trying to add some client-side list grouping functionality into my Rails app. It's
I have a rails app (running on version 2.2.2) that has a model called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.