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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:24:56+00:00 2026-05-30T06:24:56+00:00

I saw various versions of how to setup a global HTTP_REFERER in RSpec, but

  • 0

I saw various versions of how to setup a global HTTP_REFERER in RSpec, but none of them worked with RSpec 2.6.4:

RSpec.configure do |config|
  config.before(:each, :type => :controller) do
    request.env["HTTP_REFERER"] = root_url
  end
end

The request is always nil:

undefined method `env' for nil:NilClass

RSpec is calling this:

def self.eval_before_eachs(example)
  world.run_hook_filtered(:before, :each, self, example.example_group_instance, example)
  ancestors.reverse.each { |ancestor| ancestor.run_hook(:before, :each, example.example_group_instance) }
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-05-30T06:24:58+00:00Added an answer on May 30, 2026 at 6:24 am
    # spec/support/http_referer.rb  
    module HttpReferer
      def self.included(base)
        base.class_eval do
          setup :setup_http_referer if respond_to?(:setup)
        end
      end
    
      def setup_http_referer
        @request.env["HTTP_REFERER"] = "/back"
      end
    end
    
    # spec/spec_helper.rb
    RSpec.configure do |config|
      config.include HttpReferer, :type => :controller
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning about web services, and saw various examples. Some of them used @WebService
On the lolcode website I saw many references to various lolcode interpreters. But is
Here i saw various question related to usb debugging but answers not really helped
I saw the docs on the Instagram developers page. http://instagram.com/developer/endpoints/ But I want to
I saw many threads with this tittle, but no one really speak about reuse
I saw some code when studying the open source project: here . But I
Looking into various MVVM frameworks for SL. In the Caliburn documentation I saw a
It sounds simple, but I looked on various sites and it gives me only
I looked at various Haskell resources on the web, before buying the book, Real
I saw some other similar questions on this topic here but they were not

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.