Sha256: 382bf58dcdc98f39329c47855568bbb5369dfbdefc333e00776249efdb4f888f

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

class String
  include AnsiColor::String
end

describe String do
  describe "styles" do
    EFFECTS.each do |name, code|
      it "#{name}" do
        "test string".send(name).should == "#{E}#{code}mtest string#{RESET}"
      end
    end
  end

  describe "foreground colors" do
    FOREGROUND_COLORS.each do |name, code|
      it "#{name}" do
        "test string".send(name).should == "#{E}#{code}mtest string#{RESET}"
      end
    end
  end

  describe "background colors" do
    BACKGROUND_COLORS.each do |name, code|
      it "#{name}" do
        "test string".send("#{name}_background").should == "#{E}0;#{code}mtest string#{RESET}"
      end
    end
  end

  describe "color on background" do
    FOREGROUND_COLORS.each do |fg_name, fg_code|
      BACKGROUND_COLORS.each do |bg_name, bg_code|
        it "#{fg_name} on #{bg_name}" do
          "test string".send("#{fg_name}_on_#{bg_name}").should == "#{E}#{fg_code};#{bg_code}mtest string#{RESET}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
comboy-ansi_color-0.4.2 spec/ansi_color/string_spec.rb
jcf-ansi_color-0.4.1 spec/ansi_color/string_spec.rb
jcf-ansi_color-0.4.2 spec/ansi_color/string_spec.rb