Tag Archives: Rspec

How To Use The VCR Gem With Rails And Rspec

21 Oct

So yesterday I spent way too much time trying to make this really cool VCR gem work with my rspec tests. The problem was that most of the tutorials out there were pretty outdated, and things have changed a bit.

The VCR gem is really useful if you have methods that need to make an api request. You don’t want to make api requests during tests, especially if the api has some kind of rate limit (I’m looking at you Twitter!).

So what you could do is create a text file mocking the response you get from the web service you’re making the api to and do the tests that way, or you can use the VCR gem! The VCR gem makes an api request once, and records the response to a cassette, which it then uses in future tests. Clever, no?

Here’s how you set up the VCR gem in your Rails App with Rspec:
Continue reading

Here Are A Few Of My Favorite Gems (For Testing ;)

11 Aug

I absolutely LOVE the idea of Test Driven Development (TDD). Write a test, see it turn RED, write the code to make the test pass GREEN, REFACTOR your code, and keep doing it over and over again!

However, if you’ve tried writing tests, especially for Rails, you know how tedious the process could be to set up. I use Rspec for unit tests, Capybara for integration tests, Guard to keep re-running the tests every time I make changes to any files, and Spork  to have the tests run faster. And here are a few of my favorite gems that make developing and testing even more pleasant:
Continue reading

TDD: A Safety Net For The Future

30 Jun

Test Driven Development (TDD) is like exercising. It’s a lot of work, and you don’t see the results day-to-day, but you’ll be thankful you did it a few months later when you suddenly have rock-hard abs.

Continue reading

Berkeley Course: Learn Agile Development With Ruby On Rails, Github, Cucumber, RSpec, SimpleCov, Pivotal Tracker, and Heroku!!!

24 Jan

I can hardly contain my excitement right now!!! Yesterday, NatashaTheRobot reader Manoj left a comment on my post to check out the Berkeley Software Engineering for Software as a Service course. At first, I was put off by the title of this course, but as I looked deeper into it this morning, it turned out to be exactly what I was looking for! I’ve been learning Ruby on my own for the past month, and the biggest thing I’m learning is that there is a lot more to learn…

Continue reading