Sha256: 4d09d1e07c0569576c802ab7f3f7fb86a415e1848b6c03a589341d070faf6660
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' require 'vagrant-openstack-cloud-provider/errors' require 'vagrant-openstack-cloud-provider/action/connect_openstack' require "fog" RSpec.describe VagrantPlugins::OpenStack::Action::ConnectOpenStack do describe '#call?' do let (:app) { double } let (:machine) { double } let (:config) { double( :config, :region => nil, :username => 'username', :api_key => 'password', :endpoint => 'http://openstack.invalid/', :tenant => nil, ) } subject { described_class.new(app, nil) } it "should new members in env" do expect(app).to receive(:call) expect(machine).to receive(:provider_config).and_return(config) env = { :machine => machine } subject.call(env) expect(env).to have_key(:openstack_compute) expect(env).to have_key(:openstack_network) end {Fog::Compute => :openstack_compute, Fog::Network => :openstack_network}.each do |klass, attribute| it "should late-evaluate #{klass}" do expect(app).to receive(:call) expect(machine).to receive(:provider_config).and_return(config) env = { :machine => machine } expect(klass).to receive(:new).and_raise(MyError) subject.call(env) expect { env[attribute].any_call }.to raise_error(MyError) end end end end class MyError < StandardError end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-openstack-cloud-provider-1.1.9 | spec/vagrant-openstack-cloud-provider/action/connect_openstack_spec.rb |