Hi,

I'm trying to make a very simple console game, and have been using RSpec.
However, the 'have' matcher is failing for some reason.

I have a class named Game, which has a collection named Teams, defined as a
read-only attribute.

However, the following specification is failing:

it { should have(1).teams }

The code is here: http://gist.github.com/168572

It is the very last specification in the code that is failing.

I'm running RSpec 1.2.8.

Here's the output:

$ spec spec/
...F

1)
'Game before it is started  when a team is added  should have 1 teams'
FAILED
expected 1 teams, got 0
/home/Brandon/projects/baseball/spec/game_spec.rb:20:

Finished in 0.05 seconds

4 examples, 1 failure

When I manually call @game.teams.count, it returns 1, and the following spec
succeeds:

it "should have 1 team" do
  @game.teams.count.should == 1
end

Thanks,
Brandon

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to