Sha256: e35033886499460e13b3a91bcae2d1af326e1eb640c456b2e0e987bfc9d27dd3

Contents?: true

Size: 1.12 KB

Versions: 24

Compression:

Stored size: 1.12 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Page do
  dataset :sites
  
  before do
    @page = pages(:home)
  end
  
  describe "#url" do
    it "should alias default" do
      @page.should respond_to(:url_with_sites)
      @page.should respond_to(:url_without_sites)
    end
    
    it "should override slug" do
      @page.url.should eql('/')
      @page.slug = "some-slug"
      @page.url.should eql('/')
    end
  end

  describe ".find_by_url" do
    it "should default to the catchall site" do
      Page.current_site = nil
      Page.find_by_url("/").should == pages(:home)
    end
    
    it "should find site-scoped pages" do
      Page.current_site = sites(:mysite)
      Page.find_by_url("/mypage").should == pages(:myotherpage)
    end

    it "should not find pages outside the site" do
      Page.current_site = sites(:mysite)
      Page.find_by_url("/yourotherpage").should be_nil
    end
  end
  
  describe "#destroy" do
    it "should nullify homepage_id" do
      sites(:mysite).homepage_id.should_not be_nil
      pages(:home).destroy
      sites(:mysite).reload.homepage_id.should be_nil
    end
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-multi-site-extension-3.1.0 spec/models/extended_page_spec.rb
trusty-multi-site-extension-3.0.2 spec/models/extended_page_spec.rb
trusty-multi-site-extension-3.0.1 spec/models/extended_page_spec.rb
trusty-multi-site-extension-3.0.0 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.11 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.10 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.9 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.7 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.6 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.5 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.4 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.3 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.2 spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.1.pre.beta spec/models/extended_page_spec.rb
trusty-multi-site-extension-2.0.0.pre.beta spec/models/extended_page_spec.rb
trusty-multi-site-extension-1.2.1 spec/models/extended_page_spec.rb
trusty-multi-site-extension-1.2.0 spec/models/extended_page_spec.rb
trusty-multi-site-extension-1.1.5 spec/models/extended_page_spec.rb
trusty-multi-site-extension-1.1.4 spec/models/extended_page_spec.rb
trusty-multi-site-extension-1.0.4 spec/models/extended_page_spec.rb