Sha256: 28b5fd87dda0175e14c41b590d3f54f0188abd1157f7ff1c9600057ed3d92091

Contents?: true

Size: 1.79 KB

Versions: 19

Compression:

Stored size: 1.79 KB

Contents

require_relative '../../app/presenters/menu_section_presenter'
require_relative '../../app/presenters/menu_link_presenter'
require_relative '../../app/presenters/menu_widget_presenter'
require_relative '../../app/presenters/theme_presentation'

describe MenuSectionPresenter do
  describe "#name" do
    describe "when name is not defined" do
      subject { ThemePresentation.wrap(stub, MenuSectionPresenter) }

      specify { expect {|b| subject.name(&b) }.not_to yield_control }
    end

    describe "when name is present" do
      subject { ThemePresentation.wrap(stub(name:'Bob'), MenuSectionPresenter) }

      specify { expect {|b| subject.name(&b) }.to yield_control }
    end
  end

  describe "#links" do
    describe "with links" do
      subject { ThemePresentation.wrap(stub(name:'Bob', links: [stub, stub, stub]), MenuSectionPresenter) }

      it "wraps each link in a MenuLinkPresenter" do
        subject.links.each do |link|
          link.wrapped_by.should eq([MenuLinkPresenter])
        end
      end
    end

    describe "without links" do
      subject { ThemePresentation.wrap(stub(name:'Bob'), MenuSectionPresenter) }

      it "returns an empty array" do
        subject.links.should eq([])
      end
    end
  end

  describe "#widgets" do
    describe "with widgets" do
      subject { ThemePresentation.wrap(stub(name:'Bob', widgets: [stub(partial_path: '', model: {})]), MenuSectionPresenter) }

      it "wraps each widget in a MenuWidgetPresenter" do
        subject.widgets.each do |widget|
          widget.wrapped_by.should eq([MenuWidgetPresenter])
        end
      end
    end

    describe "without widgets" do
      subject { ThemePresentation.wrap(stub(name:'Bob'), MenuSectionPresenter) }

      it "returns an empty array" do
        subject.widgets.should eq([])
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
woople-theme-0.10.0 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.9.0 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.19 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.18 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.17 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.16 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.15 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.14 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.13 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.12 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.11 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.10 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.9 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.8 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.7 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.6 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.5 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.4 spec/presenters/menu_section_presenter_spec.rb
woople-theme-0.8.3 spec/presenters/menu_section_presenter_spec.rb