Optimized spec_helper, remove useless code and add the "bypass when test env" for UI.error

This commit is contained in:
Rémy Coutable 2010-11-26 00:57:08 +01:00
parent cda514cf2a
commit 3116b13f1b
3 changed files with 9 additions and 21 deletions

View File

@ -10,8 +10,10 @@ module Guard
end
def error(message, options = {})
reset_line if options[:reset]
puts "ERROR: #{message}"
unless ENV["GUARD_ENV"] == "test"
reset_line if options[:reset]
puts "ERROR: #{message}"
end
end
def debug(message, options = {})

View File

@ -1,19 +1,5 @@
require 'spec_helper'
# mute UI
module Guard::UI
class << self
def info(message, options = {})
end
def error(message)
end
def debug(message)
end
end
end
describe Guard do
describe "Class Methods" do

View File

@ -2,6 +2,8 @@ require 'rubygems'
require 'guard'
require 'rspec'
ENV["GUARD_ENV"] = 'test'
Dir["#{File.expand_path('..', __FILE__)}/support/**/*.rb"].each { |f| require f }
puts "Please do not update/create files while tests are running."
@ -9,13 +11,11 @@ puts "Please do not update/create files while tests are running."
RSpec.configure do |config|
config.color_enabled = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
config.before(:each) do
ENV["GUARD_ENV"] = 'test'
@fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
end
config.after(:each) do
ENV["GUARD_ENV"] = nil
end
end