Sha256: 37b9bbe2776e0ba738020bf666fe4f459f5ebcf4238ed85bbeffb792867a5bf0

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe Dicer::Context::Description do
  subject(:description) do
    Dicer::Context::Description.new(Entity) do
      it_behaves_like Cleaner

      role :cleaner do
        it_behaves_like Cleaner
      end
    end
  end

  describe '#described_class' do
    subject { description.described_class }

    it { should == Entity }
  end

  describe '#behaviors' do
    subject { description.behaviors }

    it { should be_a(Hash) }

    describe '#default' do
      subject { description.behaviors.default }

      it { should include(Cleaner) }
    end

    describe '[:cleaner]' do
      subject { description.behaviors[:cleaner] }

      it { should include(Cleaner) }
    end
  end

  describe '#delegator' do
    subject { description.delegator }

    it { should be_a(Class) }

    describe 'decorated entity' do
      subject(:entity) { description.delegator.new(Entity.new({})) }

      it { should respond_to(:clean) }
      it { should be_kind_of(Entity) }

      describe '#class' do
        subject { entity.class }

        it { should == Entity }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dicer-0.2.0 spec/dicer/context/description_spec.rb