Skip to content

Instantly share code, notes, and snippets.

@bmizerany
Forked from sr/app.rb
Created August 29, 2008 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmizerany/8063 to your computer and use it in GitHub Desktop.
Save bmizerany/8063 to your computer and use it in GitHub Desktop.
helpers do
def rest
@rest ||= RestClient.new('http://foo.org')
end
end
get '/' do
rest.put '/foo'
'hey'
end
describe 'My App' do
setup do
@rest = mock("rest")
RestClient.any_instance.expects(:new).return(@rest)
end
it 'should do a PUT to "/foo"' do
@rest.should_receive(:put).with('foo')
get_it '/'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment