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

James Krill
James Krill
3,759 Points

Super weird: completed_todo_item.completed_at and todo_item.completed_at are different!!

Failures:

1) Completing todo items with completed items shows completed items as complete Failure/Error: expect(page).to have_content(completed_todo_item.completed_at) expected to find text "2016-05-16 11:09:58 -0700" in "2000-01-01 18:09:58 UTC Eggs Edit Delete" # ./spec/features/todo_items/complete_spec.rb:23:in block (4 levels) in <top (required)>' # ./spec/features/todo_items/complete_spec.rb:22:inblock (3 levels) in <top (required)>'

Here is the test:

it "shows completed items as complete" do
      visit_todo_list todo_list
      within dom_id_for(completed_todo_item) do
        expect(page).to have_content(completed_todo_item.completed_at)
      end
    end

and here is the index.html.erb output:

<% if todo_item.completed? %>
        <%= todo_item.completed_at %>
      <% else %>
        <%= link_to "Mark Complete", complete_todo_list_todo_item_path(todo_item), method: :patch %>
      <% end %>

The only thing I can think is that the printed value of .completed_at is different from the value stored in the db?!?

Has anyone ever seen this?

1 Answer

Hi James,

I just added some explanation of this in another post. It is a confusing error, I agree!

I hope that helps,

Steve.