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

Tim Walker walketim at gmail.com
Tue Dec 30 19:43:54 EST 2008


I'd put

puts "========> Bid is #{Bid.inspect}" and try to learn why Bid.count
is not == 0.

HTH,

Tim

On Tue, Dec 30, 2008 at 3:17 PM, Jesse Crockett <lists at ruby-forum.com> wrote:
> Hello,
>
> I'm trying to get a positive attitude towards testing.  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
> --
> 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