Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.