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 trial

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Write Our First Tests

Different first error message then the one in the video

'require 'spec_helper'

describe "Creating todo lists" do
  it "redirects to the todo list 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("My todo list")
    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 am 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 am doing today.")
  end
end

when the code is run the error message that I get is that _Unable to find button "Create todo list"

8 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Alright, if you upload your code to Github and link it here, I will start the app on my computer and see what can be done.

Thank you, linking now...

Hi, following is the link to my project : https://github.com/testmv14/ODOT/tree/feature/Todo-List

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

OK, here's your fix, we missed one space in line 25 in the spec:

click_button "Create Todo list "

Just remove the space between list and the closing quote.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Please run the rails server, go to localhost 3000, go to that page and make sure that your button says exactly "Create Todo list" including the capitalization, whether it's not "Create Todo List" or "Create todo list" or something.

double checked it is the same name but capybara says it's not, is there an alternative to upload a screen shot of odot on my local host please?

You can upload a screenshot of "odot" to Imgur and share its link here.

Thank You!

http://imgur.com/cM2EIe9 contains screen shot of my ODOT

Are you sure you have saved the code? Did you have "Create todo list" and then you changed it to "Create Todo list" without saving it? Try to save all the files you have changed and run the server again.

Yes triple checked...

I am not sure if the error is due to my gem files, the configuration is as following:

source 'https://rubygems.org'



gem 'rails', '4.1.6'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'

group :doc do

  gem 'sdoc', '~> 0.4.0', require: false

end

group :development, :test do
  gem 'rspec-rails', '~>2.0'
end

group :test do
  gem 'capybara', '~>2.1.0'
end

Try removing this extra single quote

'require 'spec_helper'

make it

require 'spec_helper'

ah actually when I was pasting it here in the editor it overlapped but it my desktop is the correct one, thank you.