Skip to content

Instantly share code, notes, and snippets.

@anklos
Created June 7, 2011 01:41
Show Gist options
  • Save anklos/1011513 to your computer and use it in GitHub Desktop.
Save anklos/1011513 to your computer and use it in GitHub Desktop.
rspec mock and stub
server = mock_model(UI::Server)
server.stub!(:id).and_return(1)
server.stub!(:name).and_return('t1')
server.stub!(:ip_address).and_return('10.1.1.1')
server.stub!(:agent).and_return('Storage Cruiser')
UI::Server.stub!(:find_by_server_id).and_return(server)
get 'new'
response.should render_template('server_hbas/_new')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment