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 Relationships

both my todo_list_spec.rb and todo_item_spec.rb are failing after this video. Help?

here are the errors for both.

Andrews-MacBook-Pro:odot andrewgierke$ bin/rspec spec/models/todo_list_spec.rb F

Failures:

1) TodoList Failure/Error: it { should have-many(:todo_items) } ArgumentError: wrong number of arguments (0 for 1) # ./spec/models/todo_list_spec.rb:4:in `block (2 levels) in <top (required)>'

Finished in 0.00113 seconds 1 example, 1 failure

Failed examples:

rspec ./spec/models/todo_list_spec.rb:4 # TodoList

Randomized with seed 23636

Andrews-MacBook-Pro:odot andrewgierke$ bin/rspec spec/models/todo_item_spec.rb F

Failures:

1) TodoItem Failure/Error: it { should belong_to(:todo_list) } NoMethodError: undefined method belong_to' for #<RSpec::Core::ExampleGroup::Nested_1:0x007f9a9b3015f0> # ./spec/models/todo_item_spec.rb:4:inblock (2 levels) in <top (required)>'

Finished in 0.00123 seconds 1 example, 1 failure

Failed examples:

rspec ./spec/models/todo_item_spec.rb:4 # TodoItem

Randomized with seed 9429

2 Answers

Seth Reece
Seth Reece
32,867 Points

Hi Andrew,

In the latest shoulda-matchers gem you need to configure it in your spec_helper.rb (or rails_helper.rb if using rspec3.x) The code needed is in this thread

Yes! thank you, that did the trick. Back on course :)