[rspec-users] Forum.count.should, should doesn''t work?

Zhenning Guan
Tue, 19 May 2009 15:09:21 -0000

Scenario: List Tasks
  Then I should have 3 forums
-------------

Then /^I should have ([0-9]+) forums$/ do |counts|
  Forum.count.should == counts.to_i
end

===  When I go to the homepage   #
features/step_definitions/webrat_steps.rb:10
    Then I should have 3 forums #
features/step_definitions/forums_steps.rb:1
      expected: 3,
           got: 0 (using ==)
      Diff:
      @@ -1,2 +1,2 @@
      -3
      +0
       (Spec::Expectations::ExpectationNotMetError)
      features/forums.feature:8:in `Then I should have 3 forums''

1 scenario (1 failed)
2 steps (1 failed, 1 passed)

==Forum.count == counts.to_i does fine! why Forum.count.should throw a
error?
how could I do?