38 lines
1.2 KiB
Ruby
38 lines
1.2 KiB
Ruby
require 'db/mongo/models/deploy_env/deploy_env_static'
|
|
require_relative 'shared_deploy_env_specs'
|
|
|
|
RSpec.describe Devops::Model::DeployEnvStatic, type: :model do
|
|
let(:env) { build(:deploy_env_static) }
|
|
|
|
|
|
describe 'it inherits from deploy env', stubbed_logger: true, stubbed_connector: true do
|
|
before do
|
|
allow(Provider::ProviderFactory).to receive(:providers).and_return(%w(static))
|
|
allow(stubbed_connector).to receive(:users_names) { %w(root) }
|
|
end
|
|
|
|
it_behaves_like 'deploy env'
|
|
|
|
it "isn't valid if provider_account isn't present" do
|
|
allow(stubbed_connector).to receive(:provider_accounts) do |provider|
|
|
if provider == 'ec2'
|
|
account_name = 'ec2_account'
|
|
else
|
|
account_name = 'static_account'
|
|
end
|
|
[Provider::ProviderFactory.get_account_class(provider).new('account_name' => account_name)]
|
|
end
|
|
env.provider_account = 'ec2_account'
|
|
expect(env).not_to be_valid
|
|
env.provider_account = 'static_account'
|
|
expect(env).to be_valid
|
|
end
|
|
end
|
|
|
|
describe '.create' do
|
|
it 'returns instance of DeployEnvStatic' do
|
|
expect(described_class.create({})).to be_an_instance_of(Devops::Model::DeployEnvStatic)
|
|
end
|
|
end
|
|
|
|
end |