2011-11-05 21:59:17 +00:00
|
|
|
module Acceptance
|
|
|
|
# This class helps with matching against output so that every
|
|
|
|
# test isn't inherently tied to the output format of Vagrant.
|
|
|
|
class Output
|
|
|
|
def initialize(text)
|
|
|
|
@text = text
|
|
|
|
end
|
|
|
|
|
2011-11-05 22:01:00 +00:00
|
|
|
# Checks that an error message was outputted about the box
|
|
|
|
# being added being invalid.
|
2011-11-05 21:59:17 +00:00
|
|
|
def box_invalid
|
|
|
|
@text =~ /^The box file you're attempting to add is invalid./
|
|
|
|
end
|
|
|
|
|
2011-11-05 22:01:00 +00:00
|
|
|
# Checks that an error message was outputted about the path
|
|
|
|
# not existing to the box.
|
2011-11-05 21:59:17 +00:00
|
|
|
def box_path_doesnt_exist
|
|
|
|
@text =~ /^The specified path to a file doesn't exist.$/
|
|
|
|
end
|
|
|
|
|
2011-11-05 22:01:00 +00:00
|
|
|
# Tests that the box with given name is installed.
|
2011-11-05 21:59:17 +00:00
|
|
|
def box_installed(name)
|
2011-11-05 22:01:00 +00:00
|
|
|
@text =~ /^#{name}$/
|
2011-11-05 21:59:17 +00:00
|
|
|
end
|
|
|
|
|
2011-11-05 22:01:00 +00:00
|
|
|
# Tests that the output says there are no installed boxes.
|
2011-11-05 21:59:17 +00:00
|
|
|
def no_boxes
|
|
|
|
@text =~ /There are no installed boxes!/
|
|
|
|
end
|
|
|
|
|
2011-11-05 22:01:00 +00:00
|
|
|
# Tests that the output contains a specific Vagrant version.
|
2011-11-05 21:59:17 +00:00
|
|
|
def is_version?(version)
|
|
|
|
@text =~ /^Vagrant version #{version}$/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|