[rspec-users] My first tests, backwards. Please help

David Chelimsky dchelimsky at gmail.com
Tue Dec 30 17:43:47 EST 2008


On Tue, Dec 30, 2008 at 4:41 PM, Jesse Crockett <lists at ruby-forum.com> wrote:
> David Chelimsky wrote:
>> On Tue, Dec 30, 2008 at 4:17 PM, Jesse Crockett <lists at ruby-forum.com>
>> wrote:
>>> Hello,
>>>
>>> I'm trying to get a positive attitude towards testing.
>>
>> I think you already do just by virtue of this email.
>
> No comment :-)
>
>>
>> What's the failure message?
>
> I'm confused, because I don't know if the stub is returning the
> logged_in? @current_user (bort base app) and doing something I'm not
> sure what.
>
> However, I mainly get "You may be expecting an instance of
> ActiveRecord::Base.
>
> I'm so confused..  this one is the most confusing.
>
>  it "should require a credit" do
>    @user.credits = 0
>    @user.save
>    post 'bid', :bid => {:auction_id => 1, :user_id => @user, :point =>
> 1}
>    assigns[:bid].should_not be_new_record
>  end
> ===
> 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?
> ===
>
> But the model and views are all written.  The bid method is fairly
> complex.  This is the simplest test case I can think of.

Can you post the bid method?

>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list