Sha256: f5928a8550b603deaa4c36ed83c58d468f65acbcc0e35332e8317f15cea8827e

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Locomotive::Steam::Page do

  let(:attributes) { {} }
  let(:page) { described_class.new(attributes) }

  describe '#index?' do

    let(:attributes) { { fullpath: { en: 'foo/index' } } }

    subject { page.index? }
    it { is_expected.to eq false }

    context 'true' do
      let(:attributes) { { fullpath: { en: 'index' } } }
      it { is_expected.to eq true }
    end

  end

  describe '#not_found?' do

    let(:attributes) { { fullpath: { en: 'index' } } }

    subject { page.not_found? }
    it { is_expected.to eq false }

    context 'true' do
      let(:attributes) { { fullpath: { en: '404' } } }
      it { is_expected.to eq true }
    end

  end

  describe '#valid?' do

    subject { page.valid? }
    it { is_expected.to eq true }

  end

  describe '#content_type_id' do

    let(:attributes) { { target_klass_name: '42' } }
    subject { page.content_type_id }

    it { is_expected.to eq '42' }

    context 'with a Locomotive Engine class name like' do
      let(:attributes) { { target_klass_name: 'Locomotive::ContentEntryBigNumber' } }
      it { is_expected.to eq 'BigNumber' }
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
locomotivecms_steam-1.0.0.pre.beta.3 spec/unit/entities/page_spec.rb
locomotivecms_steam-1.0.0.pre.beta.2 spec/unit/entities/page_spec.rb
locomotivecms_steam-1.0.0.pre.beta.1 spec/unit/entities/page_spec.rb
locomotivecms_steam-1.0.0.pre.alpha.3 spec/unit/entities/page_spec.rb
locomotivecms_steam-1.0.0.pre.alpha.2 spec/unit/entities/page_spec.rb
locomotivecms_steam-1.0.0.pre.alpha.1 spec/unit/entities/page_spec.rb
locomotivecms_steam-1.0.0.pre.alpha spec/unit/entities/page_spec.rb