32 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require 'db/mongo/models/deploy_env/deploy_env_openstack'
 | |
| 
 | |
| RSpec.describe Devops::Model::DeployEnvOpenstack, type: :model do
 | |
|   let(:env) { build(:deploy_env_openstack) }
 | |
| 
 | |
|   before do
 | |
|     allow(Provider::ProviderFactory).to receive(:providers).and_return(%w(openstack))
 | |
|     allow_any_instance_of(Validators::Helpers::Users).to receive(:available_users).and_return(['root'])
 | |
|     allow_any_instance_of(Validators::DeployEnv::Flavor).to receive(:available_flavors).and_return([{'id' => 'flavor'}])
 | |
|     allow_any_instance_of(Validators::FieldValidator::Flavor).to receive(:available_flavors).and_return([{'id' => 'flavor'}])
 | |
|     allow_any_instance_of(Validators::DeployEnv::Groups).to receive(:available_groups).and_return(['default'])
 | |
|     allow_any_instance_of(Validators::DeployEnv::Image).to receive(:available_images).and_return([{'id' => 'image'}])
 | |
|     allow_any_instance_of(Validators::DeployEnv::Image).to receive(:available_images).and_return([{'id' => 'image'}])
 | |
|     allow_any_instance_of(Validators::DeployEnv::StackTemplate).to receive(:available_stack_templates).and_return([{'id' => 'template'}])
 | |
|     allow_any_instance_of(Validators::FieldValidator::Image).to receive(:available_images).and_return([{'id' => 'image'}])
 | |
|   end
 | |
| 
 | |
|   it_behaves_like 'deploy env'
 | |
|   it_behaves_like 'cloud deploy env'
 | |
| 
 | |
|   describe '.create' do
 | |
|     it 'returns instance of DeployEnvOpenstack' do
 | |
|       expect(described_class.create({})).to be_an_instance_of(described_class)
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   describe '#subnets_filter' do
 | |
|     it 'always returns nil' do
 | |
|       expect(env.subnets_filter).to be nil
 | |
|     end
 | |
|   end
 | |
| end | 
