require 'spec_helper'

describe Page do
  describe '.suppliers_page' do
    it 'finds by symbol locale' do
      page = create :page, name: "suppliers-about", locale: 'en', title: 'About'
      Page.suppliers_page('about', locale: :en).should eq page
    end

    it 'actually uses the locale argument' do
      page = create :page, name: "suppliers-about", locale: 'nl', title: 'About'
      Page.suppliers_page('about', locale: 'nl').should eq page
    end

    it 'returns a NullPage when no page found' do
      page = Page.suppliers_page('non-existent', locale: 'nl')
      page.should_not be_present
      page.title.should == 'Non existent'
      page.locale.should == 'nl'
    end

  end
end
