2011-05-13 19:37:24 -04:00
|
|
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2010-04-03 00:43:46 -04:00
|
|
|
|
|
|
|
describe "String extensions" do
|
|
|
|
[ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white ].each_with_index do |color, i|
|
|
|
|
it "should have #{color} color" do
|
2011-11-24 00:27:47 -05:00
|
|
|
color.to_s.send(color).should == "\e[1;#{30+i}m#{color}\e[0m"
|
2010-04-03 00:43:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should have #{color}ish color" do
|
2011-11-24 00:27:47 -05:00
|
|
|
color.to_s.send(:"#{color}ish").should == "\e[0;#{30+i}m#{color}\e[0m"
|
2010-04-03 00:43:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should have black and pale colors" do
|
|
|
|
"black".send(:black).should == "black".send(:grayish)
|
|
|
|
"pale".send(:pale).should == "pale".send(:whiteish)
|
2010-05-11 12:53:19 -04:00
|
|
|
"pale".send(:pale).should == "\e[0;37mpale\e[0m"
|
|
|
|
"whiteish".send(:whiteish).should == "\e[0;37mwhiteish\e[0m"
|
2010-04-03 00:43:46 -04:00
|
|
|
end
|
|
|
|
end
|