24 Feb '12, 9pm

Stubs and spies help you maintain the order of the Four Phase Test.

Stubs and spies help you maintain the order of the Four Phase Test.

August 6, 2009 Comments (View) Spy vs spy Update: this functionality has been extracted to the bourne gem . We’ve recently been making use of an alternative to the traditional mock-and-stub pattern common in Ruby: the Test Spy . What do you mean, spy? Test spies allow you to record method invocations for later verification. Basic usage goes something like this: describe PostsController do it "should show the given post on GET show" do post = stub('a post', :to_param => '1') Post.stubs(:find => post) get :show, :id => post.to_param Post.should have_received(:find).with(post.to_param) should render_template(:show) should assign_to(:post).with(post) end end Compare that with the traditional expectation-based example: describe PostsController do it "should show the given post on GET show" do post = stub('a post', :to_param => '1') Post.expects(:find).with(post.to_param).return...

Full article: http://robots.thoughtbot.com/post/159805295/spy-vs-spy

Tweets

Spy vs. spy: The Heartland Institute’s head-spinning hypocrisy

Spy vs. spy: The Heartland Institute’s head-spi...

grist.org 22 Feb '12, 6pm

You can't handle the truth (if you're Homeland Institute). When someone grabbed emails and documents from the computers of...

Bethenny Frankel talks marriage problems on 'Ev...

sfluxe.com 24 Feb '12, 11am

Bethenny Frankel’s marriage problems come to a head in the latest season of her Bravo show Bethenny Ever After . In a prev...

WikiLeaks aims to release documents showing Swe...

straitstimes.com 22 Feb '12, 12pm

STOCKHOLM (AFP) - WikiLeaks aims to release documents revealing that Swedish Foreign Minister Carl Bildt is a United State...