diff --git a/test/acceptance/box_test.rb b/test/acceptance/box_test.rb index 023f41768..574d04ec0 100644 --- a/test/acceptance/box_test.rb +++ b/test/acceptance/box_test.rb @@ -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")