Sha256: 6708e148b48928628a0a351ef15df2b4525c28b855d3d8a81c632b0f2f716ca5

Contents?: true

Size: 1.56 KB

Versions: 27

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'
require 'type_station/dsl'

RSpec.describe TypeStation::DSL do

  before do

    TypeStation::DSL.build 'Homepage' do
      page 'About us' do
        page 'Team'
        page 'Contact us', redirect_to: '/contact-us'
        page 'Another Page Title', template: 'standard', slug: 'another-one'
      end
      page 'Contact us'
      page 'Projects', template: 'about_us'
    end

  end


  it 'will create an index page' do
    expect(TypeStation::Page.root.title).to eq('Homepage')
  end

  it 'will set the index page template to index' do
    expect(TypeStation::Page.root.template_name).to eq('index')
  end

  it 'will create 3 children for the root page' do
    expect(TypeStation::Page.root.children.count).to eq(3)
  end

  it 'will set the about us page template name to about_us' do
    expect(TypeStation::Page.find_by_path('/about-us').template_name).to eq('about_us')
  end

  it 'will set the projects page template to about-us' do
    expect(TypeStation::Page.find_by_path('/projects').template_name).to eq('about_us')
  end

  it 'will set the about-us/contact-us page redirect_to to /contact-us' do
    expect(TypeStation::Page.find_by_path('about-us/contact-us').redirect_to).to eq('/contact-us')
  end

  it 'will create children of children' do
    expect(TypeStation::Page.find_by_path('/about-us/team')).to eq(TypeStation::Page.where(title: 'Team').first)
  end

  it 'will create a page with a defined slug' do
    expect(TypeStation::Page.find_by_path('/about-us/another-one')).to eq(TypeStation::Page.where(title: 'Another Page Title').first)
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

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