Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Changing from <ul> to <table> causes rspec errors?
In the lecture this change was made and no rspec test was attempted. However, apparently 2 failures result from this:
Failure/Error: within("ul.todo_items") do Failure/Error: expect(page.all("ul.todo_items li").size).to eq(2) ... rspec ./spec/features/todo_items/create_spec.rb:6 # Adding todo items is successful with valid content rspec ./spec/features/todo_items/index_spec.rb:18 # Viewing todo items displays item content when a todo list has items
What's the best way to fix them? Would the followings be good ok?  create_spec.rb within("table.todo_items") do  index_spec.rb expect(page.all("table.todo_items td").size).to eq(4) within "table.todo_items" do
At any point after the lesson of "Writing Test Helpers", anyone should see the "ul vs table" errors if you run "bin/rake". I think it's a defect of this course to run the extaustive test just in the begining and dimishingly doing so in the latter lessons.
The fixes temporarily work at that moment; however, later in the lecture, other tables are introduced and hence they lose uniqueness as the table so that the rspec eventually fails as below:
1) Adding todo items is successful with valid content Failure/Error: within("table.todo_items") do Capybara::Ambiguous: Ambiguous match, found 2 elements matching css "table.todo_items" # ./spec/features/todo_items/create_spec.rb:13:in `block (2 levels) in <top (required)>' 2) Viewing todo items displays item content when a todo list has items Failure/Error: within "table.todo_items" do Capybara::Ambiguous: Ambiguous match, found 2 elements matching css "table.todo_items"
There must be a better solution. Anyone?
Thank you, Maciej. I only understand your fix in theory, but I'm not knowledgable enough to implement your fix. I need the fix that is detailed for beginners.