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

Rahul Yadav
Rahul Yadav
1,399 Points

Click_link "New Todo Item"

Error:

Failure/Error: click_link "New Todo Item" NoMethodError: undefined method `permit' for nil:NilClass

# ./app/controllers/todo_items_controller.rb:25:in todo_item_params' # ./app/controllers/todo_items_controller.rb:13:innew' # ./spec/features/todo_items/create_spec.rb:15:in `block (2 levels) in <top (required)>'

2 Answers

Not really sure, could we see your tests and code?

Rahul Yadav
Rahul Yadav
1,399 Points

create_spec.rb file

require 'spec_helper'

describe "Adding todo items" do let!(:todo_list) { TodoList.create(title: "Grocery list", description: "Groceries") }

def visit_todo_list(list) visit "/todo_lists" within "#todo_list_#{list.id}" do click_link "List Items" end end

it "is successful with valid content" do visit_todo_list(todo_list) click_link "New Todo Item" fill_in "Content", with: "Milk" click_button "Save" expect(page).to have_content("Added todo list item.") within("ul.todo_items") do expect(page).to have_content("Milk") end end

end