Skip to content

Instantly share code, notes, and snippets.

@mneedham
Created February 12, 2012 23:21
Show Gist options
  • Select an option

  • Save mneedham/1811716 to your computer and use it in GitHub Desktop.

Select an option

Save mneedham/1811716 to your computer and use it in GitHub Desktop.
hello_world_spec.rb
require 'rspec'
require 'rack/test'
require 'hello_world'
require 'repository'
describe 'Hello World application' do
include Rack::Test::Methods
def app
HelloWorld
end
it 'should return Hello, world at root URL' do
mock_repo = mock('repository')
mock_repo.stub(:get).with('foo').and_return('bar')
Repository.stub(:new).and_return(mock_repo)
get '/'
last_response.body.should == 'bar'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment