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 Editing Todo Items

Chase Lee
Chase Lee
29,275 Points

Running Tests Problem With "edit_spec.rb" in "Build a Todo List Application with Rails 4."

Hi everyone!

So I doing the Editing todo items video with Jason Seifer. and at about 2:14 in the video to the left he runs a test for edit_spec.rb, which turns out to be an error for him.

But with me it gives me this 13,298 line answer on what I got wrong and stuff that I have no idea on what it's saying.

Here is my edit_spec.rb code. And here is the console output.

Thanks so much for reading!

2 Answers

Nick Fuller
Nick Fuller
9,027 Points

Hi Chase!

Segmentation faults are always super fun! That's ruby failing... your code "should" work, but apparently not with ruby 2.1

Are you using RVM? If so, I would try with the latest version of ruby 2.0.X and add a .ruby-version to the root of your rails directory with the 2.0.x in it.

Either that or a quick little google search pulled up this person having a similar issue: https://github.com/rspec/rspec-dev/issues/52

So maybe refactor this

let!(:todo_list) { TodoList.create(title: "Grocery list", description: "Groceries") }
let!(:todo_list) { todo_list.todo_items.create(content: "Milk") }

into something where you're not re-assigning the value of :todo_list?

maybe replace it with

before(:each) do
  @todo_list = TodoList.create(title: "Grocery list", description: "Groceries")
  @todo_list.todo_items.create(content: "Milk")
end

Although it will get a little funky if you have any unique constraints on either of those models. Have you worked with factory girl yet?