Sha256: 1868c9eef8c57209eb0b4c7cee0f2bd4ae0781f9a1ec9a3fb053c170271f23c1

Contents?: true

Size: 414 Bytes

Versions: 4

Compression:

Stored size: 414 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.describe Pastel::Color, '.colored?' do
  subject(:color) { described_class.new(enabled: true) }

  it "checks if string has color codes" do
    string = "foo\e[31mbar\e[0m"
    expect(color.colored?(string)).to eq(true)
  end

  it "checks that string doesn't contain color codes" do
    string = "foo\nbar"
    expect(color.colored?(string)).to eq(false)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pastel-0.5.3 spec/unit/color/colored_spec.rb
pastel-0.5.2 spec/unit/color/colored_spec.rb
pastel-0.5.1 spec/unit/color/colored_spec.rb
pastel-0.5.0 spec/unit/color/colored_spec.rb