From f0777fbb28a36b45035c235bf5a4c6c30f4c5db5 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 1 Sep 2017 17:06:59 -0400 Subject: [PATCH 1/2] Ensure `issuables_count_for_state` returns the requested state count --- app/helpers/issuables_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 5d7d33da30a..f4d452b3c9b 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -242,7 +242,7 @@ module IssuablesHelper def issuables_count_for_state(issuable_type, state) finder = public_send("#{issuable_type}_finder") # rubocop:disable GitlabSecurity/PublicSend - finder.count_by_state + finder.count_by_state[state] end def close_issuable_url(issuable) From 7cc19cd5abb4ae8649e960c71d531adccb880a89 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 1 Sep 2017 18:13:00 -0400 Subject: [PATCH 2/2] Fix a spec failure dependent on load order We were incorrectly stubbing `Issues::MoveService#execute`. This only caused a failure when another spec caused it to be autoloaded -- `spec/controllers/projects/issues_controller_spec.rb` in this case. --- spec/services/issues/update_service_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 2176469aba6..85f46838351 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -519,7 +519,7 @@ describe Issues::UpdateService, :mailer do end it 'calls the move service with the proper issue and project' do - move_stub = class_double("Issues::MoveService").as_stubbed_const + move_stub = instance_double(Issues::MoveService) allow(Issues::MoveService).to receive(:new).and_return(move_stub) allow(move_stub).to receive(:execute).with(issue, target_project).and_return(issue)