Extract acceptance specs test ui out to a separate file
This commit is contained in:
parent
a1c19371c6
commit
e86edb7087
3 changed files with 24 additions and 23 deletions
|
@ -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
|
||||
#
|
||||
|
|
22
spec/acceptance/support/test_ui.rb
Normal file
22
spec/acceptance/support/test_ui.rb
Normal 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
|
|
@ -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\//
|
||||
|
|
Loading…
Reference in a new issue