Sha256: 21f8608ef0ce83ecdc4bae0bc700226dbf7577f2250af9b01ef46ad732492d11

Contents?: true

Size: 602 Bytes

Versions: 4

Compression:

Stored size: 602 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.describe Pastel::Color, '.new' do
  it "is immutable" do
    expect(described_class.new).to be_frozen
  end

  it "allows to disable coloring" do
    color = described_class.new(enabled: false)

    expect(color.enabled?).to eq(false)
    expect(color.decorate("Unicorn", :red)).to eq("Unicorn")
  end

  it "invokes screen dependency to check color support" do
    allow(TTY::Screen).to receive(:color?).and_return(true)
    color = described_class.new

    expect(color.enabled?).to eq(true)
    expect(TTY::Screen).to have_received(:color?)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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