Sha256: 114b175e4a5f462d82fd53e19f8b8079eac4ea3ab6a304895d868dd3d4f8254a

Contents?: true

Size: 1.9 KB

Versions: 17

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'

describe Caracal::Core::Ignorables do
  subject  { Caracal::Document.new }


  #-------------------------------------------------------------
  # Public Methods
  #-------------------------------------------------------------

  describe 'public method tests' do

    #============== ATTRIBUTES =====================

    # .ignorable
    describe '.ignorable' do
      it 'delegates to registration method' do
        expect(subject).to receive(:register_ignorable)
        subject.ignorable('dummy')
      end
    end


    #============== GETTERS ========================

    # .ignorables
    describe '.ignorables' do
      it { expect(subject.ignorables).to be_a(Array) }
    end


    #============== REGISTRATION ========================

    # .register_ignorable
    describe '.register_ignorable' do
      let(:default_length) { 0 }

      describe 'when not already registered' do
        before do
          subject.register_ignorable('dummy')
        end

        it { expect(subject.ignorables.size).to eq default_length + 1 }
      end
      describe 'when already registered' do
        before do
          subject.register_ignorable('dummy')
          subject.register_ignorable('dummy')
        end

        it { expect(subject.ignorables.size).to eq default_length + 1 }
      end
    end

    # .unregister_ignorable
    describe '.unregister_ignorable' do
      let(:default_length) { 0 }

      describe 'when registered' do
        before do
          subject.register_ignorable('dummy')
          subject.unregister_ignorable('dummy')
        end

        it { expect(subject.ignorables.size).to eq default_length }
      end
      describe 'when not registered' do
        before do
          subject.register_ignorable('dummy')
          subject.unregister_ignorable('bogus')
        end

        it { expect(subject.ignorables.size).to eq default_length + 1 }
      end
    end

  end

end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
caracal_the_curve-1.4.6 spec/lib/caracal/core/ignorables_spec.rb
caracal_the_curve-1.4.5 spec/lib/caracal/core/ignorables_spec.rb
caracal_the_curve-1.4.4 spec/lib/caracal/core/ignorables_spec.rb
caracal_the_curve-1.4.3 spec/lib/caracal/core/ignorables_spec.rb
caracal_the_curve-1.4.2 spec/lib/caracal/core/ignorables_spec.rb
caracal_the_curve-1.4.1 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.4.1 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.4.0 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.3.0 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.2.0 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.1.2 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.1.1 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.1.0 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.0.13 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.0.12 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.0.11 spec/lib/caracal/core/ignorables_spec.rb
caracal-1.0.10 spec/lib/caracal/core/ignorables_spec.rb