Sha256: 035a442277ce79bb2e7a9bbc187232a5aa879aff0de42cafbba4fb5a2fa7e797

Contents?: true

Size: 1.87 KB

Versions: 22

Compression:

Stored size: 1.87 KB

Contents

require_relative '../../app/presenters/page_header_presenter'
require_relative '../../spec/support/content_image_example'

describe PageHeaderPresenter do
  let(:presenter) { PageHeaderPresenter }

  subject { PageHeaderPresenter.new(stub_presenter) }

  include_examples 'content_image'

  describe "#title" do
    describe "when the object has a name" do
      subject { PageHeaderPresenter.new(stub_presenter(name: 'Name')) }

      it "should have a name" do
        subject.title.should eq('Name')
      end
    end

    describe "when the object has a title" do
      subject { PageHeaderPresenter.new(stub_presenter(title: 'Title')) }

      it "should have the title" do
        subject.title.should eq('Title')
      end
    end
  end

  describe "#image_class" do
    describe "when the object has an image" do
      subject { PageHeaderPresenter.new(stub_presenter(image: 'image')) }

      it "has a class of page-header-with-image" do
        subject.image_class.should eq('page-header-with-image')
      end
    end

    describe "when the object does not have an image" do
      subject { PageHeaderPresenter.new(stub_presenter) }

      it "has a class of nil" do
        subject.image_class.should be_nil
      end
    end
  end

  describe "#completed_class" do
    describe "when the object is completed" do
      subject { PageHeaderPresenter.new(stub_presenter(completed?: true)) }

      it "has a class of completed" do
        subject.completed_class.should eq('completed')
      end
    end

    describe "when the object is incompleted" do
      subject { PageHeaderPresenter.new(stub_presenter(completed?: false)) }

      it "has a class of nil" do
        subject.completed_class.should be_nil
      end
    end
  end

  private

  def stub_presenter(options = {})
    defaults = {completed?: nil, description: nil}
    defaults.merge!(options)

    OpenStruct.new(defaults)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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