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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:42:18+00:00 2026-05-20T18:42:18+00:00

I am using Ruby 1.9.2 and Rails 3.0.3 I am consistently getting failing test

  • 0

I am using Ruby 1.9.2 and Rails 3.0.3

I am consistently getting failing test errors within this tutorial such as:

1) UsersController GET 'show' should show the user's micropost
 Failure/Error: get :show, :id => @user
 undefined method `model_name' for NilClass:Class
 # ./app/views/users/show.html.erb:10:in `_app_views_users_show_html_erb__2659465448390875355_2173812560_4463455946834160058'
 # ./spec/controllers/users_controller_spec.rb:39:in `block (3 levels) in <top (required)>'

show.html.erb:10 is:

<% unless @user.microposts.empty? %>
    <table class="microposts" summary="User microposts">
        <%= render @microposts %>   #line 10
    </table>
  <%= will_pagination @microposts %>
<% end %>

users_controller_spec.rb:39 is:

describe "GET 'show'" do
before(:each) do
@user = Factory(:user)
end
.
.
.
it "should show the user's micropost" do
mp1 = Factory(:micropost, :user => @user, :content => "Foo bar")
mp2 = Factory(:micropost, :user => @user, :content => "Baz quux")
get :show, :id => @user
response.should have_selector("span.content", :content => mp1.cntent)
response.should have_selector("span.content", :content => mp2.content)
end

and my app/controllers/users_controller.rb where is defines micropost is:

  def show
     @user = User.find(params[:id])
     @microposts = @user.microposts.paginate(:page => params[:page])
     @title = @user.name
  end

any help would be greatly appreciated. I have a total of 14 errors. My other errors are about

 Failure/Error: get :edit, :id => @user
 @controller is nil: make sure you set it in your test's setup method.

and

Failure/Error: test_sign_in(wrong_user)
 undefined method `sign_in' for nil:NilClass

I am also using Factory as a test sign in. Im not sure if this could be a problem. I mention this because some of the errors are:

  9) authentication of edit/update pages GET 'index' for signed-in users should have the right title
 Failure/Error: @user = test_sign_in(Factory(:user))
 Validation failed: Email has already been taken
 # ./spec/controllers/users_controller_spec.rb:222:in `block (4 levels) in <top (required)>'

If you need to see anymore code please let me know.

If someone could direct me to a place to learn more about debugging, that would be a big help as well.

  • 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-20T18:42:19+00:00Added an answer on May 20, 2026 at 6:42 pm

    For error 1 try checking your filenames for spelling and case.
    For error 9 try double checking which do..end you paste your code into.
    Working code for the tutorial can be found here https://github.com/railstutorial

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

Sidebar

Related Questions

Curious as to how to approach this same problem using ruby / rails -
using Ruby on Rails 2.3.2, since I already created Scaffold for Story, so instead
I'm using Ruby on Rails to make an application where businesses can create accounts
I am using Ruby on Rails and I need to store a search result
I'm using ruby on rails 2.3.2 and also using the acts_as_taggable_on puglin. That generated
I'm using Ruby on Rails 2.3.5 and Ruby 1.9 and implmeneted Authlogic as my
I am using Ruby on Rails with Cucumber and Capybara. How would I go
I am using Ruby on Rails 3.2.2, cucumber-rails-1.3.0, rspec-rails-2.8.1, capybara-1.1.2 and factory_girl-2.6.3. I have
I am using Ruby on Rails 3.2.2 and Cucumber with the cucumber-rails gem. I
I am using Ruby on Rails 3.2.2, cucumber-rails-1.3.0, rspec-rails-2.8.1 and capybara-1.1.2 with the Selenium

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.