I think i answered my own question. :count refers to the number of fixture
objects.


The reason why :count => 2 was passing for  views index specs is because  2
objects are being mocked and they are identical.


Hence, there are 2 stock tests:

1) asserts that there are 2 <td> elements which have the name of 'Name'

2) asserts that there are 2 <td> elements which have the name of
'Description'


 This is what a stock view index spec looks like:
---- Stock index spec view ----

describe "makes/index.html.erb" do
  before(:each) do
    assign(:makes, [
      stub_model(Make,
        :name => "Name",
        :description => "Description",
        :created_by => "",
        :updated_by => ""
      ),
      stub_model(Make,
        :name => "Name",
        :description => "Description",
        :created_by => "",
        :updated_by => ""
      )
    ])
  end

  it "renders a list of makes" do
    render
    # Run the generator again with the --webrat flag if you want to use
webrat matchers
    assert_select "tr>td", :text => "Name".to_s, :count => 2
    # Run the generator again with the --webrat flag if you want to use
webrat matchers
    assert_select "tr>td", :text => "Description".to_s, :count => 2
  end
end
---- Stock index spec view ----
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to