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 trialBrian Patterson
19,588 PointsGetting example and 1 failure
This is what I have written in the create_spec.rb file.
equire 'spec_helper'
describe "Creating todo lists" do
it "redirects to the todo list index page on success" do
visit "/todo_list"
click_link "New Todo list"
expect(page).to have_content("New Todo List")
fill_in "Title", with: "My todo list"
fill_in "Description", with: "This is what I am doing today."
click_button "Create Todo list"
expect(page).to have_content("My todo list")
end
end
The failure I am getting is: 2 deprecation warnings total
Finished in 0.01959 seconds 1 example, 1 failure
Failed examples:
rspec ./spec/features/todo_lists/create_spec.rb:4 # Creating todo lists redirects to the todo list index page on success
Randomized with seed 38375
4 Answers
Ferdinand Pretorius
18,705 PointsHi Brian,
The error message would suggest that the route you are trying to GET ( visit ) is wrong. The error also tells you that this happens on line 5 of your create_spec.rb file located at ./spec/features/todo_lists/create_spec.rb. Looking at the line:
visit "/todo_list"
Everything seems to look okay with the code, which would suggest that maybe in the string there is a spelling error. Low and behold there we have it, it should be:
visit "/todo_lists"
Notice the 's' at the end of "/todo_lists". That is the proper route!
I didn't mean to be patronizing, the idea was to give you some insight on how to read a stack trace and go about solving the errors.
I hope this helps!
Andrew Stelmach
12,583 PointsYou're missed an 'r' off your require spec_helper
statement.
It's probably not that though. It's impossible to know what the problem is without seeing the 'stack trace' - that's the bunch of errors it prints out when it fails - it should say somewhere in there what line the problem is and probably some more information that will be useful. Need to see that because there's nothing wrong with the syntax of that test, at least (except for the missing 'r').
Brian Patterson
19,588 PointsWill post the whole error message later.
Brian Patterson
19,588 PointsHave worked this out.
Brian Patterson
19,588 PointsThanks for the reply Ferdinand . I am going to stick with this course and maybe move on to your recommendation. The thing about these courses, correct me if I am wrong, they offer a template of how to do a particular app. How would you be able to add your own interpretation of an app? Maybe this is something I will learn later.
Ferdinand Pretorius
18,705 PointsThe short answer here is,
Yes and No.
Yes because:
Rails have a very strict way of writing apps. This is great because, with some rails knowledge you can easily jump into someone else's project and quickly get a feel for what is going on. For the same reason you can easily troubleshoot your apps with the "google the error message" methodology.
No because:
You get to choose the tools you want to use, therefore you still get to put your own "flavour" in your apps. You don't need to write in a test driven environment ( as is the case with this course ), however it is still highly recommended.
So you are right in thinking that they provide you with a template of how to do a particular app, but that doesn't mean that there isn't a different way to do it.
If you want to feel like you are doing something completely different, I would suggest going with Node and Express. This is very hot topics at the moment! Once you get a general understanding of those, you can throw in a bit of Angular in the mix as well, or even React( which we prefer at Edited ).
Just keep experimenting!
Brian Patterson
19,588 PointsBrian Patterson
19,588 PointsGreat ! Will try this later .
Brian Patterson
19,588 PointsBrian Patterson
19,588 PointsNow I am getting this error
This course is really frustrating !!!!!!!!!!
Ferdinand Pretorius
18,705 PointsFerdinand Pretorius
18,705 PointsHi Brian,
You are expecting your page to have the content of "New Todo List"
expect(page).to have_content("New Todo List")
But when you look at the page at /todo_lists , you will notice that the page actually has the content of New Todo list ( notice that the "l" in list is lowercase ).
Therefore, you should:
expect(page).to have_content("New Todo list")
Pay attention to the small details, and try and learn some troubleshooting methods. I don't think this is the best course for absolute beginners, I would recommend you google "rails for zombies".
Rails is a very fun and rewarding framework and I implore you to hang in there.
Good Luck!