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

  • Home
  • SEARCH
  • 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 124821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:03:40+00:00 2026-05-11T05:03:40+00:00

According to this Rails guide , if you create a fixture, it becomes available

  • 0

According to this Rails guide, if you create a fixture, it becomes available in your test class.

I have this fixture in users.yml:

<%   stan = User.new   stan.username = 'stan'   stan.set_hashed_password('mysterio')   stan.email = 'stan@abc.com' %>  stan:   username: <%= stan.username %>   hashed_password: <%= stan.hashed_password %>   password_salt: <%= stan.password_salt %>   email: <%= stan.email %> 

Following the Rails guide, I’m trying to access it like this:

class SessionsControllerTest < ActionController::TestCase    @user = users(:stan)    # ...  end 

I get this error:

./test/functional/sessions_controller_test.rb:5: undefined method `users' for SessionsControllerTest:Class (NoMethodError)     from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'     from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'     from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require' 
  • 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. 2026-05-11T05:03:40+00:00Added an answer on May 11, 2026 at 5:03 am

    Thanks for the help guys. I realized that I had various declarations and calls structured incorrectly. This isn’t clearly explained in the guide I cited, but apparently users(:stan) only works inside a should block, or in pure Test::Unit inside a test_ method.

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

Sidebar

Related Questions

according to this (older) post these Rails 3 finders have race conditions. Something like
According to (somewhat official) this guide , I can make a radio button's label
According to the Ruby on Rails 2.3 Release Notes... if your plugin has an
According to this SDK guide , unit-testing a Library project can be achieved by
According to this site , I have done the following program which sorts strings.
According to Simone Carletti blog post , Rails 3 ajax helpers have changed a
According to this answer ,it should print all function names: [root@ test]# cat hw.c
According this MSDN article HttpApplication .EndRequest can be used to close or dispose of
According to this discussion , the iphone agreement says that it doesn't allow loading
According to this article Silverlight 2 Beta 2 supports the DataContractJsonSerializer object. But, when

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.