Sha256: 991c6b11db5be66474bf0a0fa731d93697ace23096735fa808c562f1490e5fed

Contents?: true

Size: 1.35 KB

Versions: 54

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

describe Tenon::Page do
  let(:page) { Tenon::Page.new }

  describe '#subpages_for_menu' do
    context 'a page with no subpages' do
      before do
        page.stub(:subpages) { nil }
      end

      it 'should find siblings for the menu' do
        expect(page).to receive(:siblings_for_menu)
        page.subpages_for_menu
      end
    end

    context 'a page with subpages' do
      let(:subpages) { double }

      before do
        page.stub(:subpages) { subpages }
      end

      it 'should grab the subpages that are available for the menu' do
        args = { published: true, show_in_menu: true }
        expect(subpages).to receive(:where).with(args)
        page.subpages_for_menu
      end
    end
  end

  describe '#siblings_for_menu' do
    context 'when the page has no parent' do
      before do
        page.stub(:parent) { nil }
      end

      it 'should return nil' do
        expect(page.siblings_for_menu).to be_nil
      end
    end

    context 'when the page has a parent' do
      let(:parent) { double }

      before do
        page.stub(:parent) { parent }
      end

      it "should find the parent's subpages" do
        expect(parent).to receive(:subpages_for_menu)
        page.siblings_for_menu
      end
    end
  end

  describe '.reorder' do
    it 'TODO: Figure out how this works so we can test it.'
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
tenon-1.0.54 spec/models/tenon/page_spec.rb
tenon-1.0.53 spec/models/tenon/page_spec.rb
tenon-1.0.52 spec/models/tenon/page_spec.rb
tenon-1.0.51 spec/models/tenon/page_spec.rb
tenon-1.0.50 spec/models/tenon/page_spec.rb
tenon-1.0.49 spec/models/tenon/page_spec.rb
tenon-1.0.48 spec/models/tenon/page_spec.rb
tenon-1.0.47 spec/models/tenon/page_spec.rb
tenon-1.0.46 spec/models/tenon/page_spec.rb
tenon-1.0.45 spec/models/tenon/page_spec.rb
tenon-1.0.44 spec/models/tenon/page_spec.rb
tenon-1.0.43 spec/models/tenon/page_spec.rb
tenon-1.0.42 spec/models/tenon/page_spec.rb
tenon-1.0.41 spec/models/tenon/page_spec.rb
tenon-1.0.40 spec/models/tenon/page_spec.rb
tenon-1.0.39 spec/models/tenon/page_spec.rb
tenon-1.0.38 spec/models/tenon/page_spec.rb
tenon-1.0.37 spec/models/tenon/page_spec.rb
tenon-1.0.36 spec/models/tenon/page_spec.rb
tenon-1.0.35 spec/models/tenon/page_spec.rb