Fix failing tests

This commit is contained in:
Seth Vargo 2015-02-02 19:17:37 -05:00
parent bec0f28f40
commit 6fd685e96d
1 changed files with 11 additions and 10 deletions

View File

@ -48,7 +48,7 @@ describe Vagrant::Action::Builtin::BoxAdd do
AccessLog: [], AccessLog: [],
Logger: WEBrick::Log.new(tf.path, 7), Logger: WEBrick::Log.new(tf.path, 7),
Port: port, Port: port,
DocumentRoot: path.dirname.to_s, DocumentRoot: path.to_s,
MimeTypes: mime_types) MimeTypes: mime_types)
thr = Thread.new { server.start } thr = Thread.new { server.start }
yield port yield port
@ -308,7 +308,7 @@ describe Vagrant::Action::Builtin::BoxAdd do
it "adds from shorthand path" do it "adds from shorthand path" do
box_path = iso_env.box2_file(:virtualbox) box_path = iso_env.box2_file(:virtualbox)
td = Pathname.new(Dir.mktmpdir) td = Pathname.new(Dir.mktmpdir)
tf = td.join("mitchellh", "precise64.json") tf = td.join("api", "v1", "vagrant", "mitchellh", "precise64.json")
tf.dirname.mkpath tf.dirname.mkpath
tf.open("w") do |f| tf.open("w") do |f|
f.write(<<-RAW) f.write(<<-RAW)
@ -332,7 +332,7 @@ describe Vagrant::Action::Builtin::BoxAdd do
RAW RAW
end end
with_web_server(tf.dirname) do |port| with_web_server(td) do |port|
url = "http://127.0.0.1:#{port}" url = "http://127.0.0.1:#{port}"
env[:box_url] = "mitchellh/precise64.json" env[:box_url] = "mitchellh/precise64.json"
@ -341,7 +341,7 @@ describe Vagrant::Action::Builtin::BoxAdd do
expect(version).to eq("0.7") expect(version).to eq("0.7")
expect(checksum(path)).to eq(checksum(box_path)) expect(checksum(path)).to eq(checksum(box_path))
expect(opts[:metadata_url]).to eq( expect(opts[:metadata_url]).to eq(
"#{url}/#{env[:box_url]}") "#{url}/api/v1/vagrant/#{env[:box_url]}")
true true
}.and_return(box) }.and_return(box)
@ -356,7 +356,7 @@ describe Vagrant::Action::Builtin::BoxAdd do
it "add from shorthand path with configured server url" do it "add from shorthand path with configured server url" do
box_path = iso_env.box2_file(:virtualbox) box_path = iso_env.box2_file(:virtualbox)
td = Pathname.new(Dir.mktmpdir) td = Pathname.new(Dir.mktmpdir)
tf = td.join("mitchellh", "precise64.json") tf = td.join("api", "v1", "vagrant", "mitchellh", "precise64.json")
tf.dirname.mkpath tf.dirname.mkpath
tf.open("w") do |f| tf.open("w") do |f|
f.write(<<-RAW) f.write(<<-RAW)
@ -380,7 +380,7 @@ describe Vagrant::Action::Builtin::BoxAdd do
RAW RAW
end end
with_web_server(tf.dirname) do |port| with_web_server(td) do |port|
url = "http://127.0.0.1:#{port}" url = "http://127.0.0.1:#{port}"
env[:box_url] = "mitchellh/precise64.json" env[:box_url] = "mitchellh/precise64.json"
env[:box_server_url] = url env[:box_server_url] = url
@ -390,7 +390,7 @@ describe Vagrant::Action::Builtin::BoxAdd do
expect(version).to eq("0.7") expect(version).to eq("0.7")
expect(checksum(path)).to eq(checksum(box_path)) expect(checksum(path)).to eq(checksum(box_path))
expect(opts[:metadata_url]).to eq( expect(opts[:metadata_url]).to eq(
"#{url}/#{env[:box_url]}") "#{url}/api/v1/vagrant/#{env[:box_url]}")
true true
}.and_return(box) }.and_return(box)
@ -558,10 +558,11 @@ describe Vagrant::Action::Builtin::BoxAdd do
end end
it "raises an error if shorthand is invalid" do it "raises an error if shorthand is invalid" do
tf = Tempfile.new("foo") td = Pathname.new(Dir.mktmpdir)
tf.close tf = td.join("api", "v1", "vagrant", "foo")
tf.dirname.mkpath
with_web_server(Pathname.new(tf.path)) do |port| with_web_server(td) do |port|
env[:box_url] = "mitchellh/precise64.json" env[:box_url] = "mitchellh/precise64.json"
expect(box_collection).to receive(:add).never expect(box_collection).to receive(:add).never