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! While you're at it, check out some resources Treehouse students have shared here.
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 trialJ MAC
7,944 PointsPlease Help - I'm Stuck on Ruby - Build a ToDo List - Editing Todo Lists
I have Error Testing Issues encountered at 5:43 of ODOT-Stage1-video7 that are different than Jason's error and I can't get past the error - I have double checked my code in file index.html.erb
<tr id="<%= dom_id(todo_list) %>">
I have doubled checked my code in edit_spec.rb These code markups are all over the place... sorry about that!
require 'spec_helper'
describe "Editing todo lists" do
it "updates a todo list successfully with correct information" do
todo_list = TodoList.create(title: "Groceries", description: "Grocery list.")
visit "/todo_lists"
within "#todo_list_#(todo_list.id)" do
click_link "Edit"
end
fill_in "Title", with: "New title"
fill_in "Description", with: "New description"
click_button "Update Todo list"
expect(page).to have_content("Todo list was successfully updated")
expect(todo_list.title).to eq("New title")
expect(todo_list.description).to eq("New description")
end
end
Jason's error at this point on the video was on his example line 17...
expect(todo_list.title).to eq("New title")
But my error is on line 8 (of the example above)
within "#todo_list_#(todo_list.id)" do
The Failures code in the git console is as follows:
1) Editing todo lists updates a todo list successfully with correct information
Failure/Error: within "#todo_list_#(todo_list.id)" do
Nokogiri::CSS::SyntaxError:
unexpected '#' after '[#<Nokogiri::CSS::Node:0x48a21e0 @type=:CONDITIONAL SELECTOR, @value=[#<Nokogiri::CSS::Node:0x48a2258 @type=:ELEMENT_NAME, @value=["*"]>, #<Nokogiri::CSS::Node:0x48a2a50@type:ID, @value=["todo_list_"]>]>]'
# ./spec/features/todo_lists/edit_spec.rg:8:in 'block (2 levels) in <top (required)>'
Now, I can only assume that this has something to do with CSS id attribute in table row within the index.html.erb
<tr id="<%= dom_id(todo_list) %>">
Now I am at a loss how to get past this error....
PS, I am NOT using the virtual machine environment on Windows. I'm using Ruby 2.0.0p481 (2014-05-08) [i386-mingw32] on Windows 7 and rails '4.1.4'
Everything has been working fine up to this point.... I'm Stuck ;(
Thanks to anyone who even PEEKS at this!
3 Answers
Andrew Mosley
12,328 PointsDarn keyboards, try this:
within "#todo_list_#{todo_list.id}" do
should be curly braces, not parens.
J MAC
7,944 PointsTHank YOu! That fixed it. I think my eyes are fading out more than the keyboard is acting up ;)
Your assistance is greatly appreciated.
Sasha East
702 Pointsi have the same problem:
bin/rspec spec/features/todo_lists/edit_spec.rb F
Failures:
1) Editing todo lists updates a todo lists successfully with correct information
Failure/Error: within "#todo_list_#{todo_list.id}" do
NameError:
undefined local variable or method todo_list' for #<RSpec::Core::ExampleGroup::Nested_1:0x00000004446a70>
# ./spec/features/todo_lists/edit_spec.rb:8:in
block (2 levels) in <top (required)>'
Finished in 0.23372 seconds 1 example, 1 failure
and this edit_spec,rb
require 'spec_helper'
describe "Editing todo lists" do it "updates a todo lists successfully with correct information " do todo_lists = TodoList.create(title:"Groceries", description: "Grocery list.")
visit "/todo_lists"
within "#todo_list_#{todo_list.id}" do
click_link "Edit"
end
fill_in "Title", with: "New title"
fill_in "Description", with: "New description"
click_button "Update Todo_list"
todo_list.reload
expect(page).to have_content("Todo list was successfully updated.")
expect(todo_list.title).to eq("New title")
expect(todo_list.description).to eq("New description")
end end
Nathan Monte
16,643 PointsNathan Monte
16,643 PointsThank you so much