From 8850da27c3a1db7611c856d937a8b93e6b969b86 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 23 Jan 2019 11:36:29 +0100 Subject: [PATCH] Extract common `when` code between CI/CD processables --- app/models/ci/bridge.rb | 7 ------- app/models/ci/build.rb | 4 ---- app/models/concerns/ci/processable.rb | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/app/models/ci/bridge.rb b/app/models/ci/bridge.rb index 3c47e870238..5450d40ea95 100644 --- a/app/models/ci/bridge.rb +++ b/app/models/ci/bridge.rb @@ -37,13 +37,6 @@ module Ci false end - ## - # TODO we probably want to add support for `when` configuration. - # - def when - 'on_success' - end - def expanded_environment_name end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 304588a417a..35cf4f8d277 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -639,10 +639,6 @@ module Ci super || project.try(:build_coverage_regex) end - def when - read_attribute(:when) || 'on_success' - end - def options read_metadata_attribute(:options, :config_options, {}) end diff --git a/app/models/concerns/ci/processable.rb b/app/models/concerns/ci/processable.rb index e112bae7d42..1c78b1413a8 100644 --- a/app/models/concerns/ci/processable.rb +++ b/app/models/concerns/ci/processable.rb @@ -17,7 +17,7 @@ module Ci end def when - raise NotImplementedError + read_attribute(:when) || 'on_success' end def expanded_environment_name