Test that adding an invalid box results in an error
This commit is contained in:
parent
d0e191a96c
commit
d9d8029783
|
@ -20,14 +20,25 @@ class BoxTest < AcceptanceTest
|
|||
assert(results.stdout.read =~ /^foo$/, "Box should exist after it is added")
|
||||
end
|
||||
|
||||
should "give a helpful error message if the file doesn't exist" do
|
||||
# Add a box which doesn't exist
|
||||
should "give an error if the file doesn't exist" do
|
||||
results = execute("vagrant", "box", "add", "foo", "/tmp/nope/nope/nope/nonono.box")
|
||||
assert(!results.success?, "Box add should fail.")
|
||||
assert(results.stdout.read =~ /^The specified path to a file doesn't exist.$/,
|
||||
"This should show an error message about the file not existing.")
|
||||
end
|
||||
|
||||
should "give an error if the file is not a valid box" do
|
||||
invalid = @environment.workdir.join("nope.txt")
|
||||
invalid.open("w+") do |f|
|
||||
f.write("INVALID!")
|
||||
end
|
||||
|
||||
results = execute("vagrant", "box", "add", "foo", invalid.to_s)
|
||||
assert(!results.success?, "Box add should fail.")
|
||||
assert(results.stdout.read =~ /^The box file you're attempting to add is invalid./,
|
||||
"should show an error message")
|
||||
end
|
||||
|
||||
should "add a box from an HTTP server" do
|
||||
# TODO: Spin up an HTTP server to serve a file, add and test.
|
||||
skip("Need to setup HTTP server functionality")
|
||||
|
|
Loading…
Reference in New Issue