mirror of
https://github.com/czhu12/canine.git
synced 2025-12-21 10:49:49 -06:00
specs added
This commit is contained in:
@@ -32,7 +32,7 @@ class BuildCloud < ApplicationRecord
|
||||
|
||||
belongs_to :cluster
|
||||
|
||||
validates :cluster_id, uniqueness: true
|
||||
validates :cluster, uniqueness: true, presence: true
|
||||
validates :namespace, presence: true
|
||||
validates :status, presence: true
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ class BuildConfiguration < ApplicationRecord
|
||||
belongs_to :build_cloud, optional: true
|
||||
belongs_to :provider
|
||||
|
||||
validates_presence_of :project, :provider, :driver
|
||||
|
||||
enum :driver, {
|
||||
docker: 0,
|
||||
k8s: 1
|
||||
|
||||
@@ -30,5 +30,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BuildCloud, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
describe 'validations' do
|
||||
it { is_expected.to validate_presence_of(:cluster) }
|
||||
it { is_expected.to validate_presence_of(:namespace) }
|
||||
it { is_expected.to validate_presence_of(:status) }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
it { is_expected.to belong_to(:cluster) }
|
||||
end
|
||||
|
||||
describe 'enums' do
|
||||
it { is_expected.to define_enum_for(:status).with_values(pending: 0, installing: 1, active: 2, failed: 3, uninstalling: 4, uninstalled: 5, updating: 6) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,5 +25,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BuildConfiguration, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
describe 'validations' do
|
||||
it { is_expected.to validate_presence_of(:project) }
|
||||
it { is_expected.to validate_presence_of(:provider) }
|
||||
it { is_expected.to validate_presence_of(:driver) }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
it { is_expected.to belong_to(:project) }
|
||||
end
|
||||
|
||||
describe 'enums' do
|
||||
it { is_expected.to define_enum_for(:driver).with_values(docker: 0, k8s: 1) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,5 +20,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StackManager, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
describe 'validations' do
|
||||
it { is_expected.to validate_presence_of(:account) }
|
||||
it { is_expected.to validate_presence_of(:provider_url) }
|
||||
it { is_expected.to validate_presence_of(:stack_manager_type) }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
it { is_expected.to belong_to(:account) }
|
||||
end
|
||||
|
||||
describe 'enums' do
|
||||
it { is_expected.to define_enum_for(:stack_manager_type).with_values(portainer: 0) }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user