test/unit/vagrant/action/builtin/box_remove_test.rb in vagrant-unbundled-1.9.7.1 vs test/unit/vagrant/action/builtin/box_remove_test.rb in vagrant-unbundled-1.9.8.1
- old
+ new
@@ -22,11 +22,11 @@
box_dir = iso_env.box3("foo", "1.0", :virtualbox)
Vagrant::Box.new("foo", :virtualbox, "1.0", box_dir)
end
it "deletes the box if it is the only option" do
- box_collection.stub(all: [["foo", "1.0", :virtualbox]])
+ allow(box_collection).to receive(:all).and_return([["foo", "1.0", :virtualbox]])
env[:box_name] = "foo"
expect(box_collection).to receive(:find).with(
"foo", :virtualbox, "1.0").and_return(box)
@@ -39,12 +39,12 @@
expect(env[:box_removed]).to equal(box)
end
it "deletes the box with the specified provider if given" do
- box_collection.stub(
- all: [
+ allow(box_collection).to receive(:all)
+ .and_return([
["foo", "1.0", :virtualbox],
["foo", "1.0", :vmware],
])
env[:box_name] = "foo"
@@ -61,12 +61,12 @@
expect(env[:box_removed]).to equal(box)
end
it "deletes the box with the specified version if given" do
- box_collection.stub(
- all: [
+ allow(box_collection).to receive(:all)
+ .and_return([
["foo", "1.0", :virtualbox],
["foo", "1.1", :virtualbox],
])
env[:box_name] = "foo"
@@ -91,21 +91,21 @@
"name" => "foo",
"provider" => "virtualbox",
"version" => "1.0",
}
- entry.stub(valid?: valid)
+ allow(entry).to receive(:valid?).and_return(valid)
end
end
let(:action_runner) { double("action_runner") }
before do
env[:action_runner] = action_runner
- box_collection.stub(
- all: [
+ allow(box_collection).to receive(:all)
+ .and_return([
["foo", "1.0", :virtualbox],
["foo", "1.1", :virtualbox],
])
env[:box_name] = "foo"
@@ -152,11 +152,11 @@
subject.call(env)
end
end
it "errors if the box doesn't exist" do
- box_collection.stub(all: [])
+ allow(box_collection).to receive(:all).and_return([])
expect(app).to receive(:call).never
expect { subject.call(env) }.
to raise_error(Vagrant::Errors::BoxRemoveNotFound)
@@ -164,23 +164,23 @@
it "errors if the specified provider doesn't exist" do
env[:box_name] = "foo"
env[:box_provider] = "bar"
- box_collection.stub(all: [["foo", "1.0", :virtualbox]])
+ allow(box_collection).to receive(:all).and_return([["foo", "1.0", :virtualbox]])
expect(app).to receive(:call).never
expect { subject.call(env) }.
to raise_error(Vagrant::Errors::BoxRemoveProviderNotFound)
end
it "errors if there are multiple providers" do
env[:box_name] = "foo"
- box_collection.stub(
- all: [
+ allow(box_collection).to receive(:all)
+ .and_return([
["foo", "1.0", :virtualbox],
["foo", "1.0", :vmware],
])
expect(app).to receive(:call).never
@@ -191,12 +191,12 @@
it "errors if the specified provider has multiple versions" do
env[:box_name] = "foo"
env[:box_provider] = "virtualbox"
- box_collection.stub(
- all: [
+ allow(box_collection).to receive(:all)
+ .and_return([
["foo", "1.0", :virtualbox],
["foo", "1.1", :virtualbox],
])
expect(app).to receive(:call).never
@@ -207,10 +207,10 @@
it "errors if the specified version doesn't exist" do
env[:box_name] = "foo"
env[:box_version] = "1.1"
- box_collection.stub(all: [["foo", "1.0", :virtualbox]])
+ allow(box_collection).to receive(:all).and_return([["foo", "1.0", :virtualbox]])
expect(app).to receive(:call).never
expect { subject.call(env) }.
to raise_error(Vagrant::Errors::BoxRemoveVersionNotFound)