Sha256: 9ad2a4f4e3b3980efb0a48fdf5ea5d49b3cb106f937d366706e6a14f70dbfeee

Contents?: true

Size: 1016 Bytes

Versions: 4

Compression:

Stored size: 1016 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Bemer::EntityBuilder do
  context 'when block name is missing' do
    let(:entity_builder) { described_class.new(nil, :elem) }

    describe '#attrs' do
      subject { entity_builder.attrs }

      it { is_expected.to be_empty }
    end
  end

  context 'when block name and elem name are missing' do
    let(:entity_builder) { described_class.new }

    describe '#attrs' do
      subject { entity_builder.attrs }

      it { is_expected.to be_empty }
    end
  end

  context 'when an entity is a block' do
    let(:entity_builder) { described_class.new(:block) }

    describe '#attrs' do
      subject(:attrs) { entity_builder.attrs }

      it { expect(attrs).to include(class: 'block') }
    end
  end

  context 'when an entity is an element' do
    let(:entity_builder) { described_class.new(:block, :elem) }

    describe '#attrs' do
      subject(:attrs) { entity_builder.attrs }

      it { expect(attrs).to include(class: 'block__elem') }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bemer-0.6.0 spec/bemer/entity_builder_spec.rb
bemer-0.5.0 spec/bemer/entity_builder_spec.rb
bemer-0.4.0 spec/bemer/entity_builder_spec.rb
bemer-0.3.0 spec/bemer/entity_builder_spec.rb