Sha256: c2a986487db3e0b20bc87577d9b2917303c585bc4a9b935bb766395e9dd5da2c

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe Locomotive::Steam::ParentFinderService do

  let(:site)        { instance_double('Site', default_locale: :en) }
  let(:repository)  { instance_double('PageRepository', site: site, locale: :en)}
  let(:service)     { described_class.new(repository) }

  describe '#find' do

    let(:name)          { '' }
    let(:another_page)  { instance_double('Index', title: 'Index', attributes: {}, localized_attributes: {}) }
    let(:page)          { instance_double('AboutUs', title: 'About us') }

    subject { service.find(page, name).try(:title) }

    it { is_expected.to eq nil }

    describe 'using the parent keyword' do

      let(:name) { 'parent' }

      before { expect(repository).to receive(:parent_of).and_return(another_page) }

      it { is_expected.to eq 'Index' }

    end

    describe 'using the fullpath' do

      let(:name) { 'index' }

      before { expect(repository).to receive(:by_fullpath).with('index').and_return(another_page) }

      it { is_expected.to eq 'Index' }

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.8.0.alpha1 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.7.1 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.7.0 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.6.1 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.6.0 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.6.0.rc1 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.6.0.beta1 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.3 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.2 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.1 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.0 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.0.rc1 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.0.rc0 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.0.beta3 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.0.beta2 spec/unit/services/parent_finder_service_spec.rb
locomotivecms_steam-1.5.0.beta1 spec/unit/services/parent_finder_service_spec.rb