Sha256: d558345b604cde0d4c8e68850dbc15f59c84840418a4a478129114f90a089741
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' require "vagrant-profitbricks/action/list_flavors" describe VagrantPlugins::ProfitBricks::Action::ListFlavors do let(:app) { lambda { |env| } } let(:ui) { Vagrant::UI::Silent.new } let(:flavors) { Fog.mock! Fog::Compute.new({ :provider => :profitbricks, :profitbricks_username => 'anything', :profitbricks_password => 'anything' }).flavors } let(:compute_connection) { double('fog connection') } let(:env) do { :profitbricks_compute => compute_connection, :ui => ui } end subject(:action) { described_class.new(app, env) } before do allow(compute_connection).to receive(:flavors).and_return flavors end it 'get flavors from Fog' do expect(compute_connection).to receive(:flavors).and_return flavors action.call(env) end it 'writes a sorted, formatted flavor table to Vagrant::UI' do header_line = '%-36s %s' % ['Flavor ID', 'Flavor Name'] expect(ui).to receive(:info).with(header_line) flavors.sort_by(&:id).each do |flavor| formatted_line = '%-36s %s' % [flavor.id, flavor.name] expect(ui).to receive(:info).with formatted_line end action.call(env) end it 'continues the middleware chain' do expect(app).to receive(:call).with(env) action.call(env) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-profitbricks-1.0.0 | spec/vagrant-profitbricks/actions/list_flavors_spec.rb |