Sha256: 09f4b16db8b913204160cd499ca23b5b7b651dcbe457a2e132f6e61f5ddb734e
Contents?: true
Size: 1.22 KB
Versions: 9
Compression:
Stored size: 1.22 KB
Contents
# coding: utf-8 require 'spec_helper' RSpec.describe Pastel::DecoratorChain do it "is enumerable" do expect(described_class.new).to be_a(Enumerable) end it "is equatable" do expect(described_class.new).to be_a(Equatable) end describe ".each" do it "yields each decorator" do first = double('first') second = double('second') chain = described_class.new.add(first).add(second) yielded = [] expect { chain.each { |decorator| yielded << decorator } }.to change { yielded }.from([]).to([first, second]) end end describe ".==" do it "is equivalent with the same decorator" do expect(described_class.new.add(:foo).add(:bar)). to eq(described_class.new.add(:foo).add(:bar)) end it "is not equivalent with different decorator" do expect(described_class.new.add(:foo).add(:bar)). not_to eq(described_class.new.add(:foo).add(:baz)) end it "is not equivalent to another type" do expect(described_class.new.add(:foo).add(:bar)). not_to eq(:other) end end describe ".inspect" do it "displays object information" do expect(described_class.new.inspect).to match(/decorators=\[\]/) end end end
Version data entries
9 entries across 9 versions & 1 rubygems