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

David Chelimsky dchelimsky at gmail.com
Tue Dec 30 17:27:05 EST 2008


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.

> I wrote a
> controller that seems to work, and I want to make some tests.  I
> populated the test db with an auction, some users, an item, and some
> charities.  But, here is my first test, can't get it to pass.  If you
> please, can you just help me get this test to pass, and not dwell on how
> wrong my approach is?  I'll appreciate it, thanks.
>
> require File.dirname(__FILE__) + '/../spec_helper'
>
> describe "bidding on an item" do
>  controller_name :items
>  integrate_views
>
>  before :each do
>    @user = User.first
>    User.stub!(:current_user).with(@user)
>  end
>
>  it "should require a credit" do
>    @user.credits = 0
>    @user.save
>    post 'bid', :bid => {:auction_id => 1, :user_id => @user, :point =>
> 1}
>    Bid.count.should == 0
>  end
>
> end

What's the failure message?


More information about the rspec-users mailing list