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 trialgerald blady
9,052 PointsRandom Failure..
Failures:
1) Editing todo lists updates a todo list succesfully with correct info Failure/Error: expect(page).to have_content("Todo list was succesfully updated") expected to find text "Todo list was succesfully updated" in "Todo list was successfully updated. Title: New title Description: New description Edit | Back" # ./spec/features/todo_lists/edit_spec.rb:29:in `block (2 levels) in <top (required)>'
my code:
require 'spec_helper'
describe "Editing todo lists" do
def update_todo_list(options={})
options[:title] ||= "My todo list"
options[:description] ||= "This is my todo list."
todo_list = options[:todo_list]
visit "/todo_lists"
within "#todo_list_#{todo_list.id}" do
click_link "Edit"
end
fill_in "Title", with: options[:title]
fill_in "Description", with: options[:description]
click_button "Update Todo list"
end
it "updates a todo list succesfully with correct info" do
todo_list = TodoList.create(title: "Groceries", description: "Grocery list.")
update_todo_list todo_list: todo_list,
title: "New title",
description: "New description"
todo_list.reload
expect(page).to have_content("Todo list was succesfully updated")
expect(todo_list.title).to eq("New title")
expect(todo_list.description).to eq("New description")
end
end
<h1>Listing todo_lists</h1>
<table>
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @todo_lists.each do |todo_list| %>
<tr id="<%= dom_id(todo_list) %>">
<td><%= todo_list.title %></td>
<td><%= todo_list.description %></td>
<td><%= link_to 'Show', todo_list %></td>
<td><%= link_to 'Edit', edit_todo_list_path(todo_list) %></td>
<td><%= link_to 'Destroy', todo_list, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Todo list', new_todo_list_path %>
2 Answers
Maciej Czuchnowski
36,441 PointsIt's all in the error message. Your expectation and the actual flash message are different by just one character:
Todo list was succesfully
updated
Todo list was successfully
updated
gerald blady
9,052 Pointsit has to be something simple.. i'm looking at this over and over and can't figure it out.
gerald blady
9,052 Pointsgerald blady
9,052 Pointsthank you as always.. i must have looked over that for the past 20 minutes..
ugh!
:)