How should I spec this nested build:
#projects_controller.rb
def new
@account.projects.build
end
So far I have something like this:
#projects_controller_spec.rb
describe ProectssController do
describe "GET new" do
let(:account) { mock_model(Account) }
let(:project) { mock_model(Project).as_null_object }
before do
Account.stub(:find_by_subdomain!).and_return(account)
#Project.should_receive(:build).with(:account_id => account.id).and_return(project)
end
it "assigns @project" do
get :new
assigns[:project].should eq(project)
end
end
end
Not sure how I should be specing this...