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 7189189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:14:56+00:00 2026-05-28T19:14:56+00:00

My app is using OpenURI’s open() method, to fetch a web page. In my

  • 0

My app is using OpenURI’s open() method, to fetch a web page.

In my spec I want to be able to replace the URL passed in open to the path of a local file.

So when calling open('http://www.google.com') I want to switch that url to /path/to/file.

Is there a build-in way to do this in RSpec?

  • 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-05-28T19:14:57+00:00Added an answer on May 28, 2026 at 7:14 pm

    I do not think rspec provide anything to achieve this. You’re better off adding a parameter to the method that invokes open() in your application. This will make the code reusable.

    If the application code cannot be modified, you could try to overwrite the open() method to substitute the parameter in your rspec script.

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

Sidebar

Related Questions

The page I want to open using twitter app: https://twitter.com/#!/PAGE To open twitter app
I want to let a user of a web app enter a URL and
I'm using the following snippet in a Rails app: require 'open-uri' url = http://...
I've got an app that I want to be able to use Custom URL
I have a web app using forms authentication and I have restricted a folder
It's possible to open the Game Center app from your own app using: [[UIApplication
I know I can open the settings app in iOS 5 using [[UIApplication sharedApplication]
I just want my app to start a browser and load an URL. I
I need to download a csv file from my app using Open::URI and to
i am using openURL to open an app with arguments but i get errors

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.