Skip to content

Commit

Permalink
Properly remove ansi color dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Jan 27, 2025
1 parent 666436f commit 5387bd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions spec/cell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
end

it "should allow multiline content" do
cell = Cell.new :value => "barrissimo\n"+"foo".yellow, :table => Terminal::Table.new, :index => 0
cell.value.should eq "barrissimo\n"+"foo".yellow
cell.lines.should eq ['barrissimo','foo'.yellow]
cell = Cell.new :value => "barrissimo\n"+"\e[33mfoo\e[0m", :table => Terminal::Table.new, :index => 0
cell.value.should eq "barrissimo\n"+"\e[33mfoo\e[0m"
cell.lines.should eq ['barrissimo',"\e[33mfoo\e[0m"]
cell.value_for_column_width_recalc.should eq 'barrissimo'
cell.render(0).should eq " barrissimo "
end

it "should allow colorized content" do
cell = Cell.new :value => "foo".red, :table => Terminal::Table.new, :index => 0
cell = Cell.new :value => "\e[31mfoo\e[0m", :table => Terminal::Table.new, :index => 0
cell.value.should eq "\e[31mfoo\e[0m"
cell.value_for_column_width_recalc.should eq 'foo'
cell.render.should eq " \e[31mfoo\e[0m "
Expand Down
3 changes: 0 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require 'terminal-table'
require 'term/ansicolor'

class String
include Term::ANSIColor

def deindent
strip.gsub(/^ */, '')
end
Expand Down

0 comments on commit 5387bd4

Please sign in to comment.