10 Jun '12, 2am

handy way to mock a remote api for testing:

There seems to be a tendency to stub or mock classes when writing integration tests for basic http services. I'm actually not a big fan of this approach. By definition, the integration test should truly integrate with another subsystem. In the case of a http service, the tests should probably integrate over http, agreed? Here's one approach for testing services without stub or mocks... Imagine a reservation booking system that integrates with a 3rd party API. By default, you might create a Rails model that extends ActiveModel, ActiveRecord or even ActiveResource. Although you stop, after reading this blog post , and create an unbuilt Gem that reaches out to the 3rd party service. Your service might look something like this... require "rack" require "nokogiri" class ReservationService def create_reservation(reservation) url = URI.parse('http://localhost:9393/') http = Net::...

Full article: http://pivotallabs.com/users/mbarinek/blog/articles/2043-...

Tweets

Creative Testing For the Advanced Search Marketer, Part 1

Creative Testing For the Advanced Search Market...

searchengineland.com 08 Jun '12, 5pm

In a search landscape where millions of keywords define intent, generating the most compelling creative can prove to be a ...

#276 Testing Time & Web Requests - RailsCasts:

railscasts.com 10 Jun '12, 2am

It can be difficult to test code that deals with the current time or an external web request. Here I show you how to do bo...

Subway testing 3 vegan options

mnn.com 14 Jun '12, 8pm

Eating healthy when you’re traveling or simply in a rush isn’t always easy. Trying to eat vegan under those circumstances ...

Everyday Rails Testing with RSpec: The Book is ...

everydayrails.com 13 Jun '12, 1pm

Everyday Rails Testing with RSpec: The Book is complete June 13, 2012 On Monday I posted the final, edited version of Ever...

Passing Arguments to before_filter - Ruby Forum:

ruby-forum.com 08 Jun '12, 2am

Hi -- On 3/20/07, s.ross <[email protected]> wrote: > end > end > > Where I'm blocking is on how to get the 'options' data...