Here's the index.html.erb_spec.rb:
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/folders/index.html.erb" do
include FoldersHelper
before(:each) do
folder_98 = mock_model(Folder)
folder_98.should_receive(:name).and_return("MyString")
folder_98.should_receive(:top_level).and_return(false)
folder_99 = mock_model(Folder)
folder_99.should_receive(:name).and_return("MyString")
folder_99.should_receive(:top_level).and_return(false)
assigns[:folders] = [folder_98, folder_99]
end
it "should render list of folders" do
render "/folders/index.html.erb"
response.should have_tag("tr>td", "MyString", 2)
response.should have_tag("tr>td", false, 2)
end
end
This kept failing with the following message:
1)
'/folders/index.html.erb should render list of folders' FAILED
2.
<false> is not true.
This was followed by the stack trace pointing me to the following line:
response.should have_tag("tr>td", false, 2)
To fix the issue change the line to read:
response.should have_tag("tr>td", "false", 2)
Notice the quotes around false.

1 comments:
thank you. had the exact same problem with my rspec_scaffolded folders controller
Post a Comment