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 trialMatt Young
6,348 PointsRSpec Test Failures (Capybara Error)
Neither of my tests are passing. I get the following:
Failures:
1) Creating todo lists redirects to the todo lists index page on success Failure/Error: click_button "Create Todo List" Capybara::ElementNotFound: Unable to find button "Create Todo List" # ./spec/features/todo_lists/create_spec.rb:11:in `block (2 levels) in <top (required)>'
2) Creating todo lists displays an error when the todo list has no title Failure/Error: click_button "Create Todo List" Capybara::ElementNotFound: Unable to find button "Create Todo List" # ./spec/features/todo_lists/create_spec.rb:25:in `block (2 levels) in <top (required)>'
My code:
require 'spec_helper'
describe "Creating todo lists" do
it "redirects to the todo lists index page on success" do
visit "/todo_lists"
click_link "New Todo list"
expect(page).to have_content("New Todo List")
fill_in "Title", with: "My todo list"
fill_in "Description", with: "This is what I'm doing today."
click_button "Create Todo List"
expect(page).to have_content("Todo list was successfully created.")
end
it "displays an error when the todo list has no title" do
expect(TodoList.count).to eq(0)
visit "/todo_lists"
click_link "New Todo list"
expect(page).to have_content("New Todo List")
fill_in "Title", with: ""
fill_in "Description", with: "This is what I'm doing today."
click_button "Create Todo List"
expect(page).to have_content("error")
expect(TodoList.count).to eq(0)
visit "/todo_lists"
expect(page).to_not have_content("This is what I'm doing today.")
end
end
3 Answers
Maciej Czuchnowski
36,441 PointsIt looks like your button doesn't say "Create Todo List" verbatim. It's probably something like "Create Todo list" or "Create Todo_list" - run your server, navigate to that page and see what the button has on it. Underscores and capital/lowercase letters are all very important. Capybara (and programs in general) is very precise.
Justin Henderson
13,739 PointsHey Maciej,
Here is a link to the repository.
https://github.com/JustinHenderson88/ruby_to_do_list
There have been a few minor changes made that I haven't pushed quite yet. Let me know if this helps...thanks again!
Maciej Czuchnowski
36,441 PointsYou pushed some folder that contains two projects inside and I can't access todo project there.
Justin Henderson
13,739 PointsWell another issue I'm having is how can I send you a link to the Sublime text file? I don't believe I know how to do that?...
Matt Young
6,348 PointsMatt Young
6,348 PointsDuh. Silly me. Thanks. It was Create Todo list NOT Create Todo List.
Justin Henderson
13,739 PointsJustin Henderson
13,739 PointsI am experiencing the identical error and here is the code I have:
I've combed through the spec.rb sheet multiple times and have been unable to ID the potential bug. Any thoughts?
Maciej Czuchnowski
36,441 PointsMaciej Czuchnowski
36,441 PointsYou have to show us more, preferably a link to the whole app.