summaryrefslogtreecommitdiff
path: root/app/models/clusters
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2017-11-03 19:20:29 +0100
committerAlessio Caiazza <acaiazza@gitlab.com>2017-11-03 19:20:29 +0100
commitc6c9b37b1d1c9304b0eef530adb4d32178adae16 (patch)
tree5daf2d4220c36401c471550d18b0e397e602bcdb /app/models/clusters
parentc0299ce49406302a26e7fd16ec272bca19715afb (diff)
downloadgitlab-ce-c6c9b37b1d1c9304b0eef530adb4d32178adae16.tar.gz
Add Clusters::Applications::Helm tests
Diffstat (limited to 'app/models/clusters')
-rw-r--r--app/models/clusters/applications/helm.rb8
-rw-r--r--app/models/clusters/cluster.rb2
-rw-r--r--app/models/clusters/concerns/application_status.rb2
3 files changed, 7 insertions, 5 deletions
diff --git a/app/models/clusters/applications/helm.rb b/app/models/clusters/applications/helm.rb
index 54eca613ce3..42626a50175 100644
--- a/app/models/clusters/applications/helm.rb
+++ b/app/models/clusters/applications/helm.rb
@@ -3,8 +3,6 @@ module Clusters
class Helm < ActiveRecord::Base
self.table_name = 'clusters_applications_helm'
- NAME = 'helm'.freeze
-
include ::Clusters::Concerns::ApplicationStatus
belongs_to :cluster, class_name: 'Clusters::Cluster', foreign_key: :cluster_id
@@ -13,8 +11,12 @@ module Clusters
validates :cluster, presence: true
+ def self.application_name
+ self.to_s.demodulize.underscore
+ end
+
def name
- NAME
+ self.class.application_name
end
end
end
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 242bae4eb3e..7d0be3d3739 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -5,7 +5,7 @@ module Clusters
self.table_name = 'clusters'
APPLICATIONS = {
- Clusters::Applications::Helm::NAME => Clusters::Applications::Helm
+ Applications::Helm.application_name => Applications::Helm
}.freeze
belongs_to :user
diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb
index c5711fd0b58..7bb68d75224 100644
--- a/app/models/clusters/concerns/application_status.rb
+++ b/app/models/clusters/concerns/application_status.rb
@@ -24,7 +24,7 @@ module Clusters
end
event :make_scheduled do
- transition %i(installable errored) => :scheduled
+ transition any - [:scheduled] => :scheduled
end
before_transition any => [:scheduled] do |app_status, _|