Sha256: 65690779311d52d3327ea2f3879dbb8c1942ab510338596c292c112ac0cc8325

Contents?: true

Size: 1.15 KB

Versions: 27

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

RSpec.describe TypeStation::PagePresenter do
  describe 'with a page with content objects' do
    before do 
      TypeStation::Content.new
      @root = TypeStation::Page.create(title: 'Test Index')
      @page = TypeStation::Page.create(title: 'Test Page', parent: @root)
      @page.contents.build(name: :title_test, type: :text)
      @page.contents.build(name: :body, type: :html)
      @presenter = TypeStation::PagePresenter.new @page, Struct.new(:test)
    end

    it 'will create a method for each content object' do
      @page.set(:title_test, 'My word')
      @page.set(:body, 'My word')
      expect(@presenter.title_test.value).to eq('My word')
      expect(@presenter.body.value).to eq('My word')
    end

    it "will allow me to get access to the path and slug" do
      expect(@presenter.path).to eq('/test-page')
      expect(@presenter.slug).to eq('test-page')
    end

    it "will allow me to get to the page children" do
       expect(@presenter.children.class).to eq(Array)
    end

    it "will allow me to get to the parent page" do
      expect(@presenter.parent.class).to eq(TypeStation::PagePresenter)
    end

  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
type_station-0.7.0 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.6.0 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.5.4 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.5.3 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.5.2 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.5.1 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.7 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.6 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.5 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.4 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.3 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.2 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.1 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.4.0 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.3.4 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.3.3 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.3.2 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.3.1 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.3.0 spec/presenters/type_station/page_presenter_spec.rb
type_station-0.2.3 spec/presenters/type_station/page_presenter_spec.rb