@@ -198,6 +198,38 @@ class CommitsControllerTest < ActionController::TestCase
198198 end
199199 end
200200
201+ describe 'individual_named_commits' do
202+ it 'should set commits to empty array when commit_contributor is nil' do
203+ Project . any_instance . stubs ( :commit_contributors ) . returns ( stub ( find_by : nil ) )
204+ get :index , params : { project_id : @project . id , contributor_id : 0 }
205+ _ ( assigns ( :commits ) ) . must_equal [ ]
206+ end
207+ end
208+
209+ describe 'events and event_details with no analysis' do
210+ it 'should return not_found xml when project has no analysis for events' do
211+ Project . any_instance . stubs ( :best_analysis ) . returns ( NilAnalysis . new )
212+ get :events , params : { project_id : @project . id , id : @commit1 . id , contributor_id : @name1 . id } , format : :xml
213+ assert_response :not_found
214+ end
215+
216+ it 'should render 404 when contributor fact not found for event_details' do
217+ ContributorFact . stubs ( :find_by ) . returns ( nil )
218+ Airbrake . stubs ( :notify )
219+ get :event_details , params : { contributor_id : 0 , id : @commit1 . id ,
220+ project_id : @project . id , time : "commit_#{ @commit1 . time . to_i } " }
221+ assert_response :not_found
222+ end
223+ end
224+
225+ describe 'redirect_to_message_if_oversized_project' do
226+ it 'should redirect to root when project is oversized' do
227+ CommitsController . any_instance . stubs ( :oversized_project? ) . returns ( true )
228+ get :index , params : { project_id : @project . id }
229+ assert_redirected_to root_path
230+ end
231+ end
232+
201233 private
202234
203235 def create_commits
0 commit comments