Sha256: f2ff28f7e54bf67378ddf722008eaf43aa2194b1d7825dcdbe245e610df1fbd1
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
# coding: utf-8 require 'spec_helper' RSpec.describe Pastel::Delegator do it "returns delegator for color without argument" do pastel = Pastel.new(enabled: true) expect(pastel.red).to be_a(Pastel::Delegator) end describe ".inspect" do it "inspects delegator styles chain" do chain = ['red', 'on_green'] delegator = described_class.new(:resolver, chain) allow(delegator).to receive(:styles).and_return({red: 31, on_green: 42}) expect(delegator.inspect).to eq("#<Pastel @styles=[\"red\", \"on_green\"]>") end end describe ".respond_to_missing?" do context 'for a method defined on' do it "returns true" do resolver = double(:resolver) chain = double(:chain) decorator = described_class.new(resolver, chain) expect(decorator.method(:styles)).not_to be_nil end end context "for an undefined method " do it "returns false" do resolver = double(:resolver, color: true) chain = double(:chain) decorator = described_class.new(resolver, chain) expect { decorator.method(:unknown) }.to raise_error(NameError) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pastel-0.5.3 | spec/unit/delegator_spec.rb |
pastel-0.5.2 | spec/unit/delegator_spec.rb |
pastel-0.5.1 | spec/unit/delegator_spec.rb |
pastel-0.5.0 | spec/unit/delegator_spec.rb |