Sha256: ce97f866d463668e5b3b663bfe235862be7837f91865e0a17e539cfde4b86457

Contents?: true

Size: 1.3 KB

Versions: 22

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'
require 'noodall/site'

describe Noodall::Site do

  before do
    class LandingPage < Noodall::Node; end
    class Home < Noodall::Node; end
    Noodall::Site.map = {
      'home' => {
        'title' => 'Welcome',
        'type' => 'Home'
      },
      'section' => {
        'title' => 'Welcome to section',
        'type' => 'LandingPage',
        'children' => {
          'section/page' => {
            'title' => 'About this section',
            'type' => 'Page',
          },
          'section/page2' => {
            'title' => 'More info',
            'type' => 'Page',
          }
        }
      },
      'about' => {
        'title' => 'About us',
        'type' => 'Page',
      }
    }
    Noodall::Site.build!
  end

  it 'should be populated from a permalink attributues hash' do
    Noodall::Node.count.should == 5
    Noodall::Node.roots.count.should == 3
  end

  it 'should know if it contains a permalink' do
    Noodall::Site.contains?('section/page').should == true
    Noodall::Site.contains?('about').should == true
    Noodall::Site.contains?('wout').should == false
    Home.first.in_site_map?.should == true
  end

  it 'should not fail if site map is empty' do
    Noodall::Site.map = nil
    Noodall::Site.build!
    Noodall::Site.contains?('about').should == false
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
noodall-core-0.8.2 spec/site_map_spec.rb
noodall-core-0.8.1 spec/site_map_spec.rb
noodall-core-0.8.0 spec/site_map_spec.rb
noodall-core-0.7.5 spec/site_map_spec.rb
noodall-core-0.7.3 spec/site_map_spec.rb
noodall-core-0.7.2 spec/site_map_spec.rb
noodall-core-0.6.3 spec/site_map_spec.rb
noodall-core-0.6.2 spec/site_map_spec.rb
noodall-core-0.6.1 spec/site_map_spec.rb
noodall-core-0.5.7 spec/site_map_spec.rb
noodall-core-0.6.0 spec/site_map_spec.rb
noodall-core-0.5.6 spec/site_map_spec.rb
noodall-core-0.5.5 spec/site_map_spec.rb
noodall-core-0.5.4 spec/site_map_spec.rb
noodall-core-0.5.3 spec/site_map_spec.rb
noodall-core-0.5.1 spec/site_map_spec.rb
noodall-core-0.5.0 spec/site_map_spec.rb
noodall-core-0.4.8 spec/site_map_spec.rb
noodall-core-0.4.7 spec/site_map_spec.rb
noodall-core-0.4.6 spec/site_map_spec.rb