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 Validating Length

Michael Jasinski
Michael Jasinski
7,427 Points

Why is it failing for create_spec.rb

Again all of my test are failing but the app is working. Below is a list of the errors along with my code from create_spec.rb below that. I can se what lines they are on but I am doing everything the video is telling us to do.

Do I need to upgrade to RSpec3?

2 deprecation warnings total

Finished in 0.36383 seconds 4 examples, 4 failures

Failed examples:

rspec ./spec/features/todo_lists/create_spec.rb:56 # Creating todo lists displays an error when the todo list has no description rspec ./spec/features/todo_lists/create_spec.rb:37 # Creating todo lists displays an error when the todo list has less than 3 characters rspec ./spec/features/todo_lists/create_spec.rb:18 # Creating todo lists displays an error when the todo list has no title rspec ./spec/features/todo_lists/create_spec.rb:4 # Creating todo lists redirects to the todo list index page on success


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'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

it "displays an error when the todo list has less than 3 characters" 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: "Hi" 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

it "displays an error when the todo list has no description" 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: "Grocery list" fill_in "Description", with: "" 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("Grocery list") end end