fluke/devops-service/spec/shared_contexts/stubbed_env_validators.rb

14 lines
1.3 KiB
Ruby
Raw Permalink Normal View History

2015-12-10 01:24:23 +03:00
RSpec.shared_context 'stubbed calls to connector in env validators', stubbed_env_validators: true do
2015-11-20 18:31:54 +03:00
before do
allow(Provider::ProviderFactory).to receive(:providers).and_return(%w(ec2 openstack))
2016-01-20 17:47:07 +03:00
allow_any_instance_of(env_class).to receive_message_chain('provider_instance.flavors').and_return [{'id' => 'flavor'}]
2015-11-20 18:31:54 +03:00
allow_any_instance_of(Validators::Helpers::Users).to receive(:available_users).and_return(['root'])
2016-01-20 17:47:07 +03:00
# 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'}])
2015-11-20 18:31:54 +03:00
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
2015-12-07 13:04:35 +03:00
end