Extract acceptance specs test ui out to a separate file

This commit is contained in:
Fabio Rehm 2013-04-21 18:11:10 -03:00
parent a1c19371c6
commit e86edb7087
3 changed files with 24 additions and 23 deletions

View file

@ -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
#

View file

@ -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

View file

@ -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\//