1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

make tests run on windows

This commit is contained in:
Viktar Basharymau 2011-03-15 20:56:29 +02:00
parent 0f14846fcd
commit 423dd39f36
3 changed files with 5 additions and 4 deletions

View file

@ -12,7 +12,7 @@ class String
# 0 => normal
[ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white ].each_with_index do |color, i|
if STDOUT.tty? && ENV['TERM'] && ENV['TERM'] != 'dumb'
if STDOUT.tty? && ((ENV['TERM'] && ENV['TERM'] != 'dumb') || ENV['ANSICON'])
define_method color do "\033[1;#{30+i}m#{self}\033[0m" end
define_method :"#{color}ish" do "\033[0;#{30+i}m#{self}\033[0m" end
else

View file

@ -504,14 +504,15 @@ EOS
it "inherited from File should be displayed as File" do
class My < File; end
my = File.new('/dev/null')
my = File.new('nul')
my.ai(:plain => true).should == "#{my.inspect}\n" << `ls -alF #{my.path}`.chop
end
it "inherited from Dir should be displayed as Dir" do
class My < Dir; end
my = My.new('/tmp')
require 'tmpdir'
my = My.new(Dir.tmpdir)
my.ai(:plain => true).should == "#{my.inspect}\n" << `ls -alF #{my.path}`.chop
end

View file

@ -6,7 +6,7 @@ require 'ap/core_ext/logger'
describe "AwesomePrint logging extensions" do
before(:all) do
@logger = Logger.new('/dev/null')
@logger = Logger.new('nul')
end
describe "ap method" do