test/unit/vagrant/action/builtin/handle_box_test.rb in vagrant-unbundled-1.9.7.1 vs test/unit/vagrant/action/builtin/handle_box_test.rb in vagrant-unbundled-1.9.8.1
- old
+ new
@@ -36,27 +36,27 @@
subject.call(env)
end
it "doesn't do anything if a box exists" do
- machine.stub(box: box)
+ allow(machine).to receive(:box).and_return(box)
expect(action_runner).to receive(:run).never
expect(app).to receive(:call).with(env)
subject.call(env)
end
context "with a box set and no box_url" do
before do
- machine.stub(box: nil)
+ allow(machine).to receive(:box).and_return(nil)
machine.config.vm.box = "foo"
end
it "adds a box that doesn't exist" do
- expect(action_runner).to receive(:run).with { |action, opts|
+ expect(action_runner).to receive(:run).with(any_args) { |action, opts|
expect(opts[:box_name]).to eq(machine.config.vm.box)
expect(opts[:box_url]).to eq(machine.config.vm.box)
expect(opts[:box_provider]).to eq(:dummy)
expect(opts[:box_version]).to eq(machine.config.vm.box_version)
true
@@ -68,11 +68,11 @@
end
it "adds a box using any format the provider allows" do
machine.provider_options[:box_format] = [:foo, :bar]
- expect(action_runner).to receive(:run).with { |action, opts|
+ expect(action_runner).to receive(:run).with(any_args) { |action, opts|
expect(opts[:box_name]).to eq(machine.config.vm.box)
expect(opts[:box_url]).to eq(machine.config.vm.box)
expect(opts[:box_provider]).to eq([:foo, :bar])
expect(opts[:box_version]).to eq(machine.config.vm.box_version)
true
@@ -84,18 +84,18 @@
end
end
context "with a box and box_url set" do
before do
- machine.stub(box: nil)
+ allow(machine).to receive(:box).and_return(nil)
machine.config.vm.box = "foo"
machine.config.vm.box_url = "bar"
end
it "adds a box that doesn't exist" do
- expect(action_runner).to receive(:run).with { |action, opts|
+ expect(action_runner).to receive(:run).with(any_args) { |action, opts|
expect(opts[:box_name]).to eq(machine.config.vm.box)
expect(opts[:box_url]).to eq(machine.config.vm.box_url)
expect(opts[:box_provider]).to eq(:dummy)
expect(opts[:box_version]).to eq(machine.config.vm.box_version)
true
@@ -107,19 +107,19 @@
end
end
context "with a box with a checksum set" do
before do
- machine.stub(box: nil)
+ allow(machine).to receive(:box).and_return(nil)
machine.config.vm.box = "foo"
machine.config.vm.box_url = "bar"
machine.config.vm.box_download_checksum_type = "sha256"
machine.config.vm.box_download_checksum = "1f42ac2decf0169c4af02b2d8c77143ce35f7ba87d5d844e19bf7cbb34fbe74e"
end
it "adds a box that doesn't exist and maps checksum options correctly" do
- expect(action_runner).to receive(:run).with { |action, opts|
+ expect(action_runner).to receive(:run).with(any_args) { |action, opts|
expect(opts[:box_name]).to eq(machine.config.vm.box)
expect(opts[:box_url]).to eq(machine.config.vm.box_url)
expect(opts[:box_provider]).to eq(:dummy)
expect(opts[:box_version]).to eq(machine.config.vm.box_version)
expect(opts[:box_checksum_type]).to eq(machine.config.vm.box_download_checksum_type)