diff options
Diffstat (limited to 'lib/gitlab/cycle_analytics/test_helper.rb')
-rw-r--r-- | lib/gitlab/cycle_analytics/test_helper.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/gitlab/cycle_analytics/test_helper.rb b/lib/gitlab/cycle_analytics/test_helper.rb new file mode 100644 index 00000000000..32fca7fa898 --- /dev/null +++ b/lib/gitlab/cycle_analytics/test_helper.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Gitlab + module CycleAnalytics + module TestHelper + def stage_query(project_ids) + if branch + super(project_ids).where(build_table[:ref].eq(branch)) + else + super(project_ids) + end + end + + private + + def branch + @branch ||= @options[:branch] # rubocop:disable Gitlab/ModuleWithInstanceVariables + end + end + end +end |