11
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

spec_helper.rbで"uninitialized constant Rails (NameError)"に引っかかったので

Posted at

備忘録。

名前付きルートを生成するために、spec_helper.rbに
config.include Rails.application.routes.url_helpers
を入れると、

'block in <top (required)>': uninitialized constant Rails (NameError)

と出てしばらく苦戦。

同じくspec_helper.rbで
ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails'
としてあげれば上手く名前付きルートでテストできた。

参照

Rspec/Rails: uninitialized constant ActiveSupport::Autoload (NameError)
http://stackoverflow.com/questions/24875626/rspec-rails-uninitialized-constant-activesupportautoload-nameerror

11
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?