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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:48:53+00:00 2026-05-20T15:48:53+00:00

I am running rspec 2.5.1, ruby 1.9.2, and rails 3.0.5 I moved some of

  • 0

I am running rspec 2.5.1, ruby 1.9.2, and rails 3.0.5

I moved some of my settings for sending mail into a yaml file which I load in environment.rb:

APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/config.yml")

The mailer class is something like this:

class Notifier < ActionMailer::Base
  default :from => APP_CONFIG['support_email']
  ...
end

This works great in dev, but rspec coughs up a hairball before running any tests:

/.../rspec/core/backward_compatibility.rb:20:in
  'const_missing': uninitialized constant Notifier::APP_CONFIG (NameError) 
    from /rspec/expectations/backward_compatibility.rb:6:in 'const_missing'     
    from /.../app/mailers/notifier.rb:2:in '<class:Notifier>'

I am not running spork or anything like that, so I thought the rails environment had to be loaded for the tests to run? Any help figuring out what I messed up would be great.

If I should post any other parts of the code let me know in the comments, thanks.

  • 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-20T15:48:54+00:00Added an answer on May 20, 2026 at 3:48 pm

    I’ll often explicitly define constants as global constants, so that they aren’t namespaced, when I want to make the distinction. This usually helps clarify these types of issues.

    ::APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/config.yml")
    
    class Notifier < ActionMailer::Base
      default :from => ::APP_CONFIG['support_email']
      ...
    end
    

    You should probably also move that APP_CONFIG definition into the application.rb file instead of the environment.rb file in Rails 3.

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

Sidebar

Related Questions

I'm running rails 3.2.1 with rspec 2.8.1 on ruby 1.9.3p0 and when running my
When running rspec I get the following error: no such file to load --
running: ruby 1.9.3p0 with Rails 3.2.1 Trying to use rspec but when I try
After doing some stuff in Ruby on Rails with Cucumber, RSpec and Ruby BDD
I am running Rails 3.0.1 and Rspec 2.0.1. I am following M. Hartl's Ruby
I'm running: + Ruby 1.9.2p290 + Rails 3.1.1 + Rspec 2.6.0 + autotest 4.4.6
Am trying to run Rails 3.0 and Ruby 1.9.2 and am running Rspec 2.6.0
I'm trying to use Rspec 1.3.1 for my rails application which is running on
Running rails 3.2.3 with guard/spork/rspec/factory_girl and have the following in my spec helper: Spork.prefork
I am running Rails 3 Beta2 and attempting to get Autotest working with rspec.

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.