Sha256: d427ee644a1083b9cc6b46bcaeb162c2543790d0c2fb2d8347f144d0bee8a34f

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'support/sharedcontext'

require 'vagrant-libvirt/action/remove_libvirt_image'

describe VagrantPlugins::ProviderLibvirt::Action::RemoveLibvirtImage do
  subject { described_class.new(app, env) }

  include_context 'unit'

  let(:box) { instance_double(::Vagrant::Box) }

  describe '#call' do
    before do
      env[:box_removed] = box
      allow(ui).to receive(:info)
    end

    context 'when called with libvirt box removed' do
      before do
        expect(box).to receive(:provider).and_return(:libvirt)
      end

      it 'should notify the user about limited removal' do
        expect(ui).to receive(:info).with(/Vagrant-libvirt plugin removed box/)
        expect(subject.call(env)).to be_nil
      end
    end

    context 'when called with any other provider box' do
      before do
        expect(box).to receive(:provider).and_return(:virtualbox)
      end

      it 'call the next middle ware immediately' do
        expect(ui).to_not receive(:info).with(/Vagrant-libvirt plugin removed box/)
        expect(subject.call(env)).to be_nil
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vagrant-libvirt-0.10.8 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.7 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.6 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.5 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.4 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.3 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.2 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.1 spec/unit/action/remove_libvirt_image_spec.rb
vagrant-libvirt-0.10.0 spec/unit/action/remove_libvirt_image_spec.rb