Sha256: 3080f6ff93dd12f867d62921f14ebad35b24702266cc4ac1805eddf1a1ded291
Contents?: true
Size: 900 Bytes
Versions: 4
Compression:
Stored size: 900 Bytes
Contents
# coding: utf-8 require 'spec_helper' RSpec.describe Pastel::AliasImporter, '.import' do let(:color) { spy(:color, alias_color: true) } let(:output) { StringIO.new } subject(:importer) { described_class.new(color, output) } it "imports aliases from environment" do color_aliases = "funky=red,base=bright_yellow" allow(ENV).to receive(:[]).with('PASTEL_COLORS_ALIASES'). and_return(color_aliases) importer.import expect(color).to have_received(:alias_color).twice end it "fails to import incorrectly formatted colors" do color_aliases = "funky red,base=bright_yellow" allow(ENV).to receive(:[]).with('PASTEL_COLORS_ALIASES'). and_return(color_aliases) importer.import output.rewind expect(output.string).to eq("Bad color mapping `funky red`\n") expect(color).to have_received(:alias_color).with(:base, :bright_yellow) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pastel-0.5.3 | spec/unit/alias_importer_spec.rb |
pastel-0.5.2 | spec/unit/alias_importer_spec.rb |
pastel-0.5.1 | spec/unit/alias_importer_spec.rb |
pastel-0.5.0 | spec/unit/alias_importer_spec.rb |