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 trialSasha East
702 Pointserror while running spec edit_spec.rb
spec code:
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
4 Answers
Steve Hunter
57,712 PointsOK - next up ... try making this singular:
todo_lists = TodoList.create( # other code
Change to:
todo_list = TodoList.create( # other code
Steve Hunter
57,712 PointsWhat's the error - that'll help us pin down whether it is code or a fail etc.
Steve.
Sasha East
702 Pointsin/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:0x000000047f94d8>
# ./spec/features/todo_lists/edit_spec.rb:8:in
block (2 levels) in <top (required)>'
Finished in 0.40068 seconds 1 example, 1 failure
Failed examples:
rspec ./spec/features/todo_lists/edit_spec.rb:4 # Editing todo lists updates a todo lists successfully with correct information
I`m try this lesson https://teamtreehouse.com/library/build-a-todo-list-application-with-rails-4/build-a-todo-list-application-with-rails-4/editing-todo-lists
Steve Hunter
57,712 PointsAh, yes - your line:
within "todo_list_#{todo_list.id}" do
needs to have an additional hash in there:
within "#todo_list_#{todo_list.id}" do
That should clear that error and either throw another one or run O.
Hope it works!
Steve.
Sasha East
702 Pointserror still exist
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:0x000000053303b0>
# ./spec/features/todo_lists/edit_spec.rb:8:in
block (2 levels) in <top (required)>'
spec:
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
Sasha East
702 PointsSasha East
702 Pointsthank you for help! it`s worked! when i typed code from video, i made some mistakes. where i can get source code from video lessons (maybe github)?
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsNot sure about Github - you can try my repo but I can't guarantee it is totally correct. And the commits are pretty random and won't follow the course structure, I don't think.
https://github.com/OnlySteveH/ODOT