Sha256: d4b566fced574d5872ba4aeae0cbdf94401df90f4f1e36a0583a62938d379b10

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Spud::Cms::SitemapsController do
  describe :show do
    before(:each) do
        Spud::Core.configure do |config|
          config.site_name = "Test Site"
          config.multisite_mode_enabled = false
          config.multisite_config = []
        end

      end
    it "should return the sitemap urls" do

      get :show, :format => :xml

      assigns(:pages).should == SpudPage.published_pages.public.order(:spud_page_id)
    end

    it "should only respond to an XML format" do
      expect {
        get :show
      }.to raise_exception(ActionController::UnknownFormat)
    end

    describe :multisite do
      before(:each) do
        Spud::Core.configure do |config|
          config.site_name = "Test Site"
          config.multisite_mode_enabled = true
          config.multisite_config = [{:hosts => ["test.host"], :site_name =>"Site B", :site_id => 1}]
        end
      end

      it "should only assign pages for current site" do
        2.times {|x|  s = FactoryGirl.create(:spud_page)}
        3.times {|x|  s = FactoryGirl.create(:spud_page,:site_id => 1)}

        get :show, :format => :xml

        assigns(:pages).should == SpudPage.published_pages.public.order(:spud_page_id).site(1)

      end

    end
  end


end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spud_cms-1.0.0 spec/controllers/spud/cms/sitemaps_controller_spec.rb
spud_cms-1.0.0.rc1.4 spec/controllers/spud/cms/sitemaps_controller_spec.rb
spud_cms-1.0.0.rc1.3 spec/controllers/spud/cms/sitemaps_controller_spec.rb
spud_cms-1.0.0.rc1.2 spec/controllers/spud/cms/sitemaps_controller_spec.rb
spud_cms-1.0.0.rc1.1 spec/controllers/spud/cms/sitemaps_controller_spec.rb
spud_cms-1.0.0.RC1 spec/controllers/spud/cms/sitemaps_controller_spec.rb