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 trialSuleiman Leadbitter
15,805 PointsBuild a Todo List Application: Adding Todo Items
I'm at this part of the course and everything seemed to be going pretty well until right at the end.
I'm putting in the code to terminal - bin/rspec --format=documentation spec/features/todo_items/create_spec.rb
But I'm getting an error that I am really unsure about.
Adding todo items
is successful with valid content (FAILED - 1)
Failures:
1) Adding todo items is successful with valid content
Failure/Error: expect(page).to have_content("Added todo list item")
expected to find text "Added todo list item" in "Grocery list Milk New Todo Item"
# ./spec/features/todo_items/create_spec.rb:18:in `block (2 levels) in <top (required)>'
Finished in 0.9907 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/features/todo_items/create_spec.rb:13 # Adding todo items is successful with valid content
I have even downloaded the project files to compare but can't seem to find any differences.
I also have it uploaded to Github if anyone knows what to look for - https://github.com/Sulcalibur/treehouse-odot
Due to me really not knowing what I'm doing, I just haven't a clue really, sorry :/
2 Answers
Amy Kang
17,188 PointsLooks like your flash message is not showing up. In your layouts/application.html.erb file try putting "=" in the message tag.
<% flash.each do |type, message| %>
<div class="alert flash <%= type %>">
<%= message %>
</div>
<% end %>
It should now show the message.
Andrew Stelmach
12,583 PointsFirst of all, Suleiman, nice one for putting all of your code up - hardly anyone does that, and it means they usually don't get answers.
Don't give up on this - there is a ton of learning to be had here. I'll help you.
Looking at your test error message, I'm not sure your app is going to the correct page after clicking save when adding an item.
In your browser, try to create a new todo list item. Enter 'milk' into the box. What happens when you click save?
Suleiman Leadbitter
15,805 PointsThanks Andrew Stelmach. I'm not giving up, I'm determined to get through the whole Ruby track so expect a few more forum posts lol
Suleiman Leadbitter
15,805 PointsSuleiman Leadbitter
15,805 PointsThank you! Such a silly reason for me to come to a standstill :/
Amy Kang
17,188 PointsAmy Kang
17,188 PointsYou're welcome! Glad it helped. :)