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

The Archive Base Latest Questions

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

For easier organization, I’d like to namespace a couple folders under my /spec directory.

  • 0

For easier organization, I’d like to namespace a couple folders under my /spec directory. So rather than /spec/requests, I’d like to use /spec/another_directory/requests.

However, when I run my specs under these new namespaced directories, I get

NoMethodError:
       undefined method `whatever_path'

So, it looks as those my routes are no longer being properly loaded. If I move the file back up to spec/requests (without the namespace), all is well and the test is green.

Not really sure what the issue is. I’m requiriing ‘spec_helper’ in my files. I’ve also seen:

require File.dirname(__FILE__) + '/../../spec_helper'

and its variations, but I’m not really sure how that helps because it seems to load the spec_helper, just not the routes. And to further make things fun, I’m reloading the routes before each run in the Spork.pre_fork block

Spork.each_run do
  load "#{Rails.root}/config/routes.rb"
end

but I still get the error whether Spork is running or not.

What am I doing wrong?

(rspec-rails 2.8.1)

  • 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:21:22+00:00Added an answer on May 30, 2026 at 6:21 am

    I think, this is due request example before hook is not fired. If you look further, you can understand how rspec-rails decide which example type it runs.

    I suggest you to use spec/requests/another_directory schema or you can try to reconfigure Rspec somewhat like:

    RSpec::configure do |config|
       config.include RSpec::Rails::RequestExampleGroup, :type => :request,
            :example_group => {:file_path => 'path/to/your/requests')}
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably easier than I am making it, but basically what I need
It's easier to be told by example. I have URLs like http://domain/product/view/id/ . How
Is there an easier way to do something like the following in Core Data:
Is there an easier way to debug IIS Url Rewrite configurations than this ?:
is there an easier way to replace lowercase letters with another character like a
Is there an easier way to check whether an std::unordered_map::insert call succeeded than writing
Is there an easier way of safely extracting submitted variables other than the following?
This looks a lot easier than I am probably making it sound. I have
Is there an easier way than foreach($_POST as $x=>$y){ $arr[$x] = $this->input->get_post($y, TRUE); }
It's much easier to show the Javascript code than offer a complex explanation: var

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.