Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created October 15, 2011 17:07
Show Gist options
  • Save edipofederle/1289848 to your computer and use it in GitHub Desktop.
Save edipofederle/1289848 to your computer and use it in GitHub Desktop.
test.rb
def mock_client(stubs={})
@mock_client ||= mock_model(Client, stubs)
end
describe "GET index" do
it "should redirect to index page with clients obj" do
Client.stub(:find).with(:all, :order => "created_at desc").and_return([mock_client])
get :index
response.should render_template("index")
assigns[:clients].should == [mock_client]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment