When I get an error like this, I like to examine what the page actually did have on it. I usually use puts page.body right before the assertion.
Something worth mentioning: in general, programming is pretty much a succession of “I’m getting this weird error…what now?”, and fighting with the problem until you figure it out. Sometimes that takes a few hours. Sometimes a whole day. When you’re new, it’s tempting to ask someone more experienced to diagnose things, but you’ll miss out on learning a vital skill for all programmers – debugging an error.
You’ll know you’re ready to ask for help from someone else when you’ve already narrowed down the problem substantially and have tried a half-dozen things that didn’t work.
One other thing to think about: if you’re using the same versions of the tools that Josh is and getting different results, you’ve probably missed a step somewhere, or done something wrong in a previous step. I’d recommend backtracking to a state where things are working correctly and then moving forward again carefully.
And that’s the part I did NOT see as a newbie when watching the videos or looking at Ryan Bates’ Railscasts where everything works perfectly. I never saw Ryan Bates (or thoughtbt guys) struggling through trying to figure out weird errors. I find myself struggling sometimes for DAYS, which is very discouraging. So I was thinking I was screwing something up and needed to ask before procedding to try anything further…because when I see you guys pull it off without a hitch in the videos, and see how easy it is for Ryan Bates to get everything to work perfectly in his Railscasts, I was left with the impression that I had to ask in order to make sure I was doing the “learning computer programming” thing right, if that makes any sense.
::Note to self:: When running up against weird errors, go on a major recon mission and fight with the errors so I can get good at fighting with the errors - then I will be a good programmer.
That is such a good point. I’m really glad you raised it.
Most screencasts you see are heavily edited, and the ones that aren’t are probably shot after numerous practice runs (I prep for dozens of hours before my live-coding talks).
The real work of programming involves quite a bit of fighting with code that “totally should work”, I’m afraid.
You can at least take solace that you’re very, very, very much not alone. This stuff is hard. For everyone.
I’m going to post a screencast soon where our CTO Joe Ferris tackles the Shakespeare exercise. Joe is particularly good at not getting stuck, but you’ll that even he has several head-scratching moments while developing.
And here I thoguht I just wasn’t educated/skilled enough with computers to “get everything right.” It is good to know I was wrong. I was actually half-tempted to try one of the thoughtbot code challenges but was afraid to try because I thought I had to be good enoough at this to be able to fly right through it without a hitch (like Matt Mongeau, aka “Goose”), without getting all balled up with errors out the wazoo. Now I could kick myself for not taking a crack at it, because that Shakespear exercize looked interesting to me. I also didn’t try a code challenge at Arlington Ruby that was right up my alley but I lacked the confidence to try it because I thought, as someone VERY new to computer programming and learning a computer language, that I would just be making a fool of myself and not be able to do it because I can never seem to get code right without a ton of errors. It always bugged me that I declined to try that code challenge, because it was about writing code that would display or print out all the natural numbers that are primes (I was a pure math major in college many years ago). So I just froze. I sat there like a bump on a log, too terrified to try while in a room full of computer genius guys. If I would have known that it was hard for them, too, I would not have sat that one out. I would have jumped right in instead of feeling too self-consious.
Well said @benorenstein and @Jacqueline. I wrote about teaching programming basics trying to emphasize the importance of making mistakes and not feeling bad at all about it, just because it’s a natural part of the act of programming.
Somehow, I like small mistakes or “let me think about this for a minute” moments in screencasts because they make the presenters more human and, if they share what they’re thinking, teach you about the way they reason about the problem they’re facing. I recently watched the refactoring video with Joe and Chad and really liked how they explain the reasons behind the choices they make – I’d love to see more content in that direction, sharing how people at thoughtbot think when facing a problem.
I’ve been learning Clojure for fun. As an exercise, I’ve been implementing tic-tac-toe. You can see the repo here if you’re curious.
It’s taken me about 5 hours to get just a small slice of functionality done. At this point I can print boards and also tell you if someone has won yet or not.
Just now, I watched a screencast where someone implemented the full game, plus an AI to play against, in 50 minutes. He didn’t backtrack once and barely made any mistakes. Even as someone that knows that it’s tough work learning a new language or paradigm, it’s hard not to be discouraged by that.
However, I’m going to fight through this feeling, because it’s totally normal, and happens to everybody learning something difficult.
I’m new to the Learn Prime program and was going through the 3rd Party services video (testing with Twitter.) I ran into a few issues since I’m using newer versions of ruby, rails, rspec, etc. But if anyone is having some issues and want to review what I’ve done, here is a link to my repo: hashtag
I just started the Mocking, Stubs and Spies video so that part is not included (at least not at the time of this post.)
I added a file, How_To_Use-the-Twitter-API, to my repo with some notes that might be helpful.