Sha256: 4feaefe17815afa9a77e061a5e23111177f6fc2ac34d2f0cd533af4525c05bdc

Contents?: true

Size: 1.3 KB

Versions: 29

Compression:

Stored size: 1.3 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
        expect(subpages).to receive(:for_menu)
        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 an empty array' do
        expect(page.siblings_for_menu).to eq([])
      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

29 entries across 29 versions & 1 rubygems

Version Path
tenon-1.1.8 spec/models/tenon/page_spec.rb
tenon-1.1.7 spec/models/tenon/page_spec.rb
tenon-1.1.6 spec/models/tenon/page_spec.rb
tenon-1.1.5 spec/models/tenon/page_spec.rb
tenon-1.1.4 spec/models/tenon/page_spec.rb
tenon-1.1.3 spec/models/tenon/page_spec.rb
tenon-1.1.2 spec/models/tenon/page_spec.rb
tenon-1.1.1 spec/models/tenon/page_spec.rb
tenon-1.0.76 spec/models/tenon/page_spec.rb
tenon-1.0.75 spec/models/tenon/page_spec.rb
tenon-1.0.74 spec/models/tenon/page_spec.rb
tenon-1.0.73 spec/models/tenon/page_spec.rb
tenon-1.0.72 spec/models/tenon/page_spec.rb
tenon-1.0.71 spec/models/tenon/page_spec.rb
tenon-1.0.70 spec/models/tenon/page_spec.rb
tenon-1.0.69 spec/models/tenon/page_spec.rb
tenon-1.0.68 spec/models/tenon/page_spec.rb
tenon-1.0.67 spec/models/tenon/page_spec.rb
tenon-1.0.66 spec/models/tenon/page_spec.rb
tenon-1.0.65 spec/models/tenon/page_spec.rb