diff --git a/spec/acceptance/sanity_check_spec.rb b/spec/acceptance/sanity_check_spec.rb index 68810c5..6c891fe 100644 --- a/spec/acceptance/sanity_check_spec.rb +++ b/spec/acceptance/sanity_check_spec.rb @@ -1,28 +1,5 @@ require 'acceptance_helper' -class TestUI < Vagrant::UI::Interface - attr_reader :messages - - METHODS = [:clear_line, :report_progress, :warn, :error, :info, :success] - - def initialize(resource = nil) - super - @messages = METHODS.each_with_object({}) { |m, h| h[m] = [] } - end - - def ask(*args) - super - # Automated tests should not depend on user input, obviously. - raise Errors::UIExpectsTTY - end - - METHODS.each do |method| - define_method(method) do |message, *opts| - @messages[method].push message - end - end -end - # Monkey patch vagrant in order to reuse the UI test object that is set on # our Vagrant::Environments # diff --git a/spec/acceptance/support/test_ui.rb b/spec/acceptance/support/test_ui.rb new file mode 100644 index 0000000..5f9a84c --- /dev/null +++ b/spec/acceptance/support/test_ui.rb @@ -0,0 +1,22 @@ +class TestUI < Vagrant::UI::Interface + attr_reader :messages + + METHODS = [:clear_line, :report_progress, :warn, :error, :info, :success] + + def initialize(resource = nil) + super + @messages = METHODS.each_with_object({}) { |m, h| h[m] = [] } + end + + def ask(*args) + super + # Automated tests should not depend on user input, obviously. + raise Errors::UIExpectsTTY + end + + METHODS.each do |method| + define_method(method) do |message, *opts| + @messages[method].push message + end + end +end diff --git a/spec/acceptance_helper.rb b/spec/acceptance_helper.rb index 13708eb..03105f9 100644 --- a/spec/acceptance_helper.rb +++ b/spec/acceptance_helper.rb @@ -12,6 +12,8 @@ end require 'vagrant' require 'vagrant-lxc' +Dir[File.dirname(__FILE__) + "/acceptance/support/**/*.rb"].each { |f| require f } + # RSpec.configure do |config| # config.include AcceptanceExampleGroup, :type => :unit, :example_group => { # :file_path => /\bspec\/unit\//