Sha256: 46a909f465d144a4f322b7d136c2afebb16382755474962ffb8ae870fd0bf872

Contents?: true

Size: 391 Bytes

Versions: 11

Compression:

Stored size: 391 Bytes

Contents

# encoding: utf-8

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

11 entries across 11 versions & 2 rubygems

Version Path
pokedex-terminal-0.2.8 vendor/bundle/ruby/2.7.0/gems/pastel-0.7.3/spec/unit/color/colored_spec.rb
pokedex-terminal-0.2.7 vendor/bundle/ruby/2.7.0/gems/pastel-0.7.3/spec/unit/color/colored_spec.rb
pokedex-terminal-0.2.6 vendor/bundle/ruby/2.7.0/gems/pastel-0.7.3/spec/unit/color/colored_spec.rb
pokedex-terminal-0.2.5 vendor/bundle/ruby/2.7.0/gems/pastel-0.7.3/spec/unit/color/colored_spec.rb
pokedex-terminal-0.2.4 vendor/bundle/ruby/2.7.0/gems/pastel-0.7.3/spec/unit/color/colored_spec.rb
pastel-0.7.3 spec/unit/color/colored_spec.rb
pastel-0.7.2 spec/unit/color/colored_spec.rb
pastel-0.7.1 spec/unit/color/colored_spec.rb
pastel-0.7.0 spec/unit/color/colored_spec.rb
pastel-0.6.1 spec/unit/color/colored_spec.rb
pastel-0.6.0 spec/unit/color/colored_spec.rb