File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ def self.enable(io, force=false)
3030 end
3131
3232 def color?
33+ $stderr. puts "@@color_force: #{ @@color_force . inspect } "
34+ $stderr. puts "Foreman.windows?: #{ Foreman . windows? . inspect } "
35+ $stderr. puts "self.respond_to?(:isatty): #{ self . respond_to? ( :isatty ) . inspect } "
36+ $stderr. puts "self.isatty: #{ self . isatty . inspect } "
37+ $stderr. puts "ENV['TERM']: #{ ENV [ "TERM" ] . inspect } "
38+
3339 return @@color_force unless @@color_force . nil?
3440 return false if Foreman . windows?
3541 return false unless self . respond_to? ( :isatty )
Original file line number Diff line number Diff line change 5656 output = `bundle exec foreman start -f #{ resource_path "Procfile.bad" } && echo success`
5757 expect ( output ) . not_to include 'success'
5858 end
59+
60+ it "successfully enables color control chars, by default" do
61+ allow_any_instance_of ( Foreman ::Engine ::CLI ::Color ) . to receive ( :isatty ) . and_return ( true )
62+ fake_term_value = 'xterm-256color'
63+ output = `env -- TERM='#{ fake_term_value } ' bundle exec foreman start -f #{ resource_path ( "Procfile" ) } `
64+
65+ expect ( output . scan ( "\x1B " ) ) . not_to be_empty
66+ end
67+
68+ it "successfully enables color control chars, when specified" do
69+ allow_any_instance_of ( Foreman ::Engine ::CLI ::Color ) . to receive ( :isatty ) . and_return ( true )
70+ fake_term_value = 'xterm-256color'
71+ output = `env -- TERM='#{ fake_term_value } ' bundle exec foreman start -f #{ resource_path ( "Procfile" ) } --color`
72+
73+ expect ( output . scan ( "\x1B " ) ) . not_to be_empty
74+ end
75+
76+ it "successfully disables color control chars, when specified" do
77+ allow_any_instance_of ( Foreman ::Engine ::CLI ::Color ) . to receive ( :isatty ) . and_return ( true )
78+
79+ fake_term_value = 'xterm-256color'
80+ output = `env -- TERM='#{ fake_term_value } ' bundle exec foreman start -f #{ resource_path ( "Procfile" ) } --color=false`
81+
82+ expect ( output . scan ( "\x1B " ) ) . to be_empty
83+ end
5984 end
6085 end
6186
You can’t perform that action at this time.
0 commit comments