Sha256: b14da1a01722cf5dce087e4368d28dad4570cff0fdb8294235d442252c359ea3

Contents?: true

Size: 1.03 KB

Versions: 26

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

26 entries across 26 versions & 3 rubygems

Version Path
xcpretty-0.4.0 spec/xcpretty/ansi_spec.rb
xcpretty-security-patched-0.3.2 spec/xcpretty/ansi_spec.rb
xcpretty-security-patched-0.3.0 spec/xcpretty/ansi_spec.rb
xcpretty-0.3.0 spec/xcpretty/ansi_spec.rb
xcpretty-0.2.8 spec/xcpretty/ansi_spec.rb
xcpretty-0.2.7 spec/xcpretty/ansi_spec.rb
xcpretty-0.2.6 spec/xcpretty/ansi_spec.rb
xcpretty-0.2.4 spec/xcpretty/ansi_spec.rb
xcpretty-0.2.3 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb14 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb13 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb12 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb11 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb10 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb9 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb8 spec/xcpretty/ansi_spec.rb
xcpretty-0.2.2 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb7 spec/xcpretty/ansi_spec.rb
xcpretty-0.2.1 spec/xcpretty/ansi_spec.rb
xcpretty-bb-0.1.12.bb6 spec/xcpretty/ansi_spec.rb