Sha256: fc585459f9bf1e055db6d38e577a8d01d5fc81d0a22049476a46cae060303d97

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 KB

Contents

require "xcpretty/ansi"

module XCPretty
  describe ANSI do
    include ANSI

    before do
      self.colorize = true
      @text = "This is the PARTY"
    end

    describe "color helpers" do
      it "colors text red" do
        red(@text).should == "\e[31m#{@text}\e[0m"
      end

      it "formats text bold" do
        white(@text).should == "\e[39;1m#{@text}\e[0m"
      end

      it "colors text green" do
        green(@text).should == "\e[32;1m#{@text}\e[0m"
      end

      it "colors text cyan" do
        cyan(@text).should == "\e[36m#{@text}\e[0m"
      end
    end

    describe "custom color mixing" do
      it "can mix random known colors" do
        ansi_parse(@text, :yellow, :underline).should == "\e[33;4m#{@text}\e[0m"
      end
    end

    describe "debug helpers" do
      it "can remove formatting from text" do
        strip("\e[33;4m#{@text}\e[0m").should == @text
      end

      it "can list known applied effects" do
        applied_effects("\e[33;1m#{@text}\e[0m").should == [:yellow, :bold]
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
learn-xcpretty-0.1.12 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.12 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.11 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.10 spec/xcpretty/ansi_spec.rb
learn-xcpretty-0.1.11 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.9 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.8 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.7 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.6 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.5 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.4 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.3 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.2 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.1 spec/xcpretty/ansi_spec.rb
xcpretty-0.1.0 spec/xcpretty/ansi_spec.rb
xcpretty-0.0.9 spec/xcpretty/ansi_spec.rb
xcpretty-0.0.8 spec/xcpretty/ansi_spec.rb
xcpretty-0.0.7 spec/xcpretty/ansi_spec.rb
xcpretty-0.0.6 spec/xcpretty/ansi_spec.rb
xcpretty-0.0.5 spec/xcpretty/ansi_spec.rb