Sha256: 4f004ef130a2960f094be09ba12078bd4b5081771e20f4e0bfbffbab9b7be51a

Contents?: true

Size: 714 Bytes

Versions: 6

Compression:

Stored size: 714 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.describe Pastel, '.alias_color' do

  subject(:pastel) { described_class.new(enabled: true) }

  it "aliases color" do
    pastel.alias_color(:funky, :red)
    expect(pastel.funky('unicorn')).to eq("\e[31municorn\e[0m")
  end

  it "aliases color and combines with regular ones" do
    pastel.alias_color(:funky, :red)
    expect(pastel.funky.on_green('unicorn')).to eq("\e[31;42municorn\e[0m")
  end

  it "reads aliases from the environment" do
    color_aliases = "funky=red"
    allow(ENV).to receive(:[]).with('PASTEL_COLORS_ALIASES').
      and_return(color_aliases)
    described_class.new(enabled: true)
    expect(pastel.valid?(:funky)).to eq(true)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pastel-0.5.3 spec/unit/alias_color_spec.rb
pastel-0.5.2 spec/unit/alias_color_spec.rb
pastel-0.5.1 spec/unit/alias_color_spec.rb
pastel-0.5.0 spec/unit/alias_color_spec.rb
pastel-0.4.0 spec/unit/alias_color_spec.rb
pastel-0.3.0 spec/unit/alias_color_spec.rb