specs added

This commit is contained in:
Celina Lopez
2025-08-27 12:08:39 -07:00
parent ca841c82d3
commit 84dae5d184
5 changed files with 42 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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