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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:25:47+00:00 2026-05-11T01:25:47+00:00

I’m sorry, but this is beginning to feel like kicking myself in the head.

  • 0

I’m sorry, but this is beginning to feel like kicking myself in the head. I’m completely baffled by RSpec. Have watched video after video, read tutorial after tutorial, and still I’m just stuck on square one.

=== here is what I’m working with

http://github.com/fudgestudios/bort/tree/master

=== Errors

F  1) NoMethodError in 'bidding on an item should work' You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.new_record? spec/controllers/auction_controller_spec.rb:16: spec/controllers/auction_controller_spec.rb:6:  Finished in 0.067139 seconds  1 example, 1 failure 

=== here is my controller action

  def bid        @bid = Bid.new(params[:bid])       @bid.save    end 

=== here is my test

require File.dirname(__FILE__) + '/../spec_helper' include ApplicationHelper include UsersHelper include AuthenticatedTestHelper  describe 'bidding on an item' do   controller_name :items      before(:each) do       @user = mock_user       stub!(:current_user).and_return(@user)     end    it 'should work' do     post 'bid', :bid => { :auction_id => 1, :user_id => @user.id, :point => 1 }     assigns[:bid].should be_new_record   end  end 

=== spec_helper

http://github.com/fudgestudios/bort/tree/master/spec/spec_helper.rb

It’s very disheartening to wake for work at 3 a.m. and accomplish nothing for the day. Please understand.

  • 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-11T01:25:47+00:00Added an answer on May 11, 2026 at 1:25 am

    You’ve got a couple of things backwards in before(:each). Seeing as the example is specifying that the post should increase the count by 1, you’re dealing with real records and there is no reason for stubbing anything at all. Also, at this point, since there is only one example, there is no reason to have a before block. I’d do it this way:

    describe ItemsController, 'bidding on an item' do   fixtures :users    it 'should create a new Bid' do     login_as :quentin     lambda do       post 'bid', :bid => { :auction_id => 1, :user_id => @user.id, :point => 1 }     end.should change(Bid, :count).by(1)   end  end 

    One thing I’d recommend is creating these things VERY granularly for now until you understand them better. Start with the expectation (post should change bid count), run the spec and let the failure message guide you to add whatever else you need in the spec or in the code.

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

Sidebar

Ask A Question

Stats

  • Questions 59k
  • Answers 59k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer If you use wsdl.exe at the command line, you can… May 11, 2026 at 9:03 am
  • added an answer Use an expression like this: SUM(IIF(myData!Name.Value = 'John', 1, 0))… May 11, 2026 at 9:03 am
  • added an answer In my MVC apps I'm using architecture that Rob Conery… May 11, 2026 at 9:03 am

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.