back to

Ruby on Rails To-do List

ARCHIVED

Archived: This project has been archived. Cards can no longer be completed.

Writing my first tests

Stefy
Stefy completed this card.
  1. bin/rake spec
  2. Make a directory to hold these particular specs:
  3. mkdir -p spec/features/todo_lists
  •  The -p will make any subdirectories that aren't there
  •  Integration test: tests the whole behavior of our                application

Test that creating todo_lists works:
ouch spec/features/todo_lists/create_spec.rb 

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	
end 

Adding validations

Open app > model > todolist

validates :title, presence: true