Building specs for the controller. #1135
This commit is contained in:
@@ -8,3 +8,27 @@ describe DeliverablesController do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe DeliverablesController,"#index when logged in" do
|
||||
before(:each) do
|
||||
@project = mock_model(Project)
|
||||
Deliverable.stub!(:find_all_by_project_id).and_return([])
|
||||
Project.should_receive(:find).with(@project.to_param).and_return(@project)
|
||||
controller.stub!(:authorize).and_return(true)
|
||||
end
|
||||
|
||||
it "should be successful" do
|
||||
get :index, :id => @project.id
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it "should set @deliverables for the view" do
|
||||
get :index, :id => @project.id
|
||||
assigns[:deliverables].should_not be_nil
|
||||
end
|
||||
|
||||
it "should only show the deliverables for the current project only" do
|
||||
Deliverable.should_receive(:find_all_by_project_id).with(@project.id)
|
||||
get :index, :id => @project.id
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user