Skip to content

Instantly share code, notes, and snippets.

@coxandrew
Created January 26, 2011 01:46
Show Gist options
  • Save coxandrew/796069 to your computer and use it in GitHub Desktop.
Save coxandrew/796069 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe ProjectsController do
def mock_project(stubs={})
@mock_project ||= mock_model(Project, stubs).as_null_object
end
before(:each) do
controller.stub!(:current_user).and_return(@current_user)
end
describe "GET show" do
it "assigns the requested project as @project" do
Project.stub(:find).with("1") { mock_project }
get :show, :id => "1"
assigns(:project).should be(mock_project)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment