diff options
-rw-r--r-- | lib/gitlab/cycle_analytics/test_helper.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/cycle_analytics/test_helper.rb b/lib/gitlab/cycle_analytics/test_helper.rb index 287b5fc5cbd..9bd2d83fcdc 100644 --- a/lib/gitlab/cycle_analytics/test_helper.rb +++ b/lib/gitlab/cycle_analytics/test_helper.rb @@ -3,15 +3,19 @@ module Gitlab module CycleAnalytics module TestHelper - # rubocop:disable Gitlab/ModuleWithInstanceVariables def stage_query(project_ids) - if @options[:branch] - super(project_ids).where(build_table[:ref].eq(@options[:branch])) + if branch + super(project_ids).where(build_table[:ref].eq(branch)) else super(project_ids) end end - # rubocop:enable Gitlab/ModuleWithInstanceVariables + + private + + def branch + @branch ||= @options[:branch] + end end end end |