vagrant-lxc-ng/spec/unit/action/compress_rootfs_spec.rb
Fabio Rehm 2e2c2fad56 Convert specs to RSpec 2.99.0.beta2 syntax with Transpec
This conversion is done by Transpec 1.10.2 with the following command:
    transpec

* 46 conversions
    from: obj.should
      to: expect(obj).to

* 20 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 10 conversions
    from: == expected
      to: eq(expected)

* 6 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 5 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 5 conversions
    from: Klass.any_instance.stub(:message) { |arg| }
      to: Klass.any_instance.stub(:message) { |instance, arg| }

* 5 conversions
    from: Klass.any_instance.stub(:message)
      to: allow_any_instance_of(Klass).to receive(:message)

* 1 conversion
    from: lambda { }.should
      to: expect { }.to
2014-03-14 11:38:54 -03:00

30 lines
1 KiB
Ruby

require 'unit_helper'
require 'vagrant-lxc/plugin'
require 'vagrant-lxc/provider'
require 'vagrant-lxc/action/compress_rootfs'
describe Vagrant::LXC::Action::CompressRootFS do
let(:app) { double(:app, call: true) }
let(:env) { {machine: machine, ui: double(info: true)} }
let(:machine) { double(Vagrant::Machine, provider: provider) }
let(:provider) { double(Vagrant::LXC::Provider, driver: driver) }
let(:driver) { double(Vagrant::LXC::Driver, compress_rootfs: compressed_rootfs_path) }
let(:compressed_rootfs_path) { '/path/to/rootfs.tar.gz' }
subject { described_class.new(app, env) }
before do
provider.stub_chain(:state, :id).and_return(:stopped)
subject.call(env)
end
it "asks the driver to compress container's rootfs" do
expect(driver).to have_received(:compress_rootfs)
end
it 'sets export.temp_dir on action env' do
expect(env['package.rootfs']).to eq(compressed_rootfs_path)
end
end