bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.

Friday, July 18, 2014

save_and_open_page method

When I interviewed for this job, I have to admit I said I had Capybara experience but I honestly really didn't. The most experience I had was from install it on my app and not knowing how to use it. I also had failing integration test on my Hartl app but commented them out. Thanks to this job I was able to understand how to use Capybara and even write actual integration test. 

One thing I learned that has been tremendously helpful is using the save_and_open_page method, you literally place that code above the last line of your test and Capybara will save and open that instance of the page, no internet required. Now you will be able to check out the page and find out why a test is failing, by seeing what info is not displaying.

Check out the following blogpost for more info: Ever heard of the sava_and_open_page method?



I find it very similar to how I have learned how to debug Javascript, using the alert("foo") or console.log("foo"), but thats another blog post. If you are unfamiliar with integration testing checkout thoughbot's blogpost on it.

I realize some of these post will not be useful to some readers of my blog. I recommend keeping these tips in the back your mind, because they will eventually become very useful. I am personally using them as my notes to go back to, just as the Ruby Rogues explained. I hope to google the save_and_open_page method one day or any other tipI wrote about and find it in the top ranking on google. So save this, bookmark it, and thanks for reading.


*Please note this method will not work without the gem "launchy"

No comments:

Post a Comment