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 Writing Test Helpers

Brian Patterson
Brian Patterson
19,588 Points

Please help.

When I run the bin/rspec spec/features/ at 2.47 I get this failure.

treehouse:~/projects/odot (master *) $ bin/rspec spec/features/ ......FFF............

Failures:

1) Viewing todo items displays the title of the todo list Failure/Error: visit_todo_list(todo_list) NoMethodError: undefined method visit_todo_list' for #<RSpec::Core::ExampleGroup::Nested_4:0xb97f394c> # ./spec/features/todo_items/index_spec.rb:9:inblock (2 levels) in <top (required)>'

2) Viewing todo items displays no items when a todo list is empty Failure/Error: visit_todo_list(todo_list) NoMethodError: undefined method visit_todo_list' for #<RSpec::Core::ExampleGroup::Nested_4:0xb97fa364> # ./spec/features/todo_items/index_spec.rb:16:inblock (2 levels) in <top (required)>'

3) Viewing todo items displays item content when a todo list has items Failure/Error: visit_todo_list(todo_list) NoMethodError: undefined method visit_todo_list' for #<RSpec::Core::ExampleGroup::Nested_4:0xb980f868> # ./spec/features/todo_items/index_spec.rb:24:inblock (2 levels) in <top (required)>'

Don't know what I have done wrong.

1 Answer

Hi Brian,

Have you got this defined inside spec/support/todo_list_helpers.rb?

You should have refactored that method out of each spec file nd into the support folder as it was being repeated in all the tests.

You should have a module called TodoListHelpers inside which you define the visit_todo_list(list) method.

Let me know how you get on.

Steve.