Merge pull request #9355 from briancain/fix-sticky-travis-test

Fix sticky Travis CI test
This commit is contained in:
Brian Cain 2018-01-10 09:55:24 -08:00 committed by GitHub
commit 12d4f4eb6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 27 deletions

View File

@ -283,47 +283,43 @@ describe Vagrant::Action::Builtin::BoxAdd, :skip_windows do
context "with a box name accidentally set as a URL" do context "with a box name accidentally set as a URL" do
it "displays a warning to the user" do it "displays a warning to the user" do
box_path = iso_env.box2_file(:virtualbox) box_path = iso_env.box2_file(:virtualbox)
with_web_server(box_path) do |port| port = 9999
box_url_name = "http://127.0.0.1:#{port}/#{box_path.basename}" box_url_name = "http://127.0.0.1:#{port}/#{box_path.basename}"
env[:box_name] = box_url_name env[:box_name] = box_url_name
expect(box_collection).to receive(:add).with(any_args) { |path, name, version, **opts| expect(box_collection).to receive(:add).with(any_args) { |path, name, version, **opts|
expect(name).to eq(box_url_name) expect(name).to eq(box_url_name)
expect(version).to eq("0") expect(version).to eq("0")
expect(opts[:metadata_url]).to be_nil expect(opts[:metadata_url]).to be_nil
true true
}.and_return(box) }.and_return(box)
expect(app).to receive(:call).with(env) expect(app).to receive(:call).with(env)
expect(env[:ui]).to receive(:warn) expect(env[:ui]).to receive(:warn)
.with(/It looks like you attempted to add a box with a URL for the name/) .with(/It looks like you attempted to add a box with a URL for the name/)
subject.call(env) subject.call(env)
end
end end
end end
context "with a box name containing invalid URI characters" do context "with a box name containing invalid URI characters" do
it "should not raise an error" do it "should not raise an error" do
box_path = iso_env.box2_file(:virtualbox) box_path = iso_env.box2_file(:virtualbox)
with_web_server(box_path) do |port| box_url_name = "box name with spaces"
env[:box_name] = box_url_name
box_url_name = "box name with spaces" expect(box_collection).to receive(:add).with(any_args) { |path, name, version, **opts|
env[:box_name] = box_url_name expect(name).to eq(box_url_name)
expect(version).to eq("0")
expect(opts[:metadata_url]).to be_nil
true
}.and_return(box)
expect(box_collection).to receive(:add).with(any_args) { |path, name, version, **opts| expect(app).to receive(:call).with(env)
expect(name).to eq(box_url_name)
expect(version).to eq("0")
expect(opts[:metadata_url]).to be_nil
true
}.and_return(box)
expect(app).to receive(:call).with(env) subject.call(env)
subject.call(env)
end
end end
end end