Sha256: dca447ee0ec5f502a18b6c91fd5a9bb6c4a62c8bf8d9b3fdc106cb809a44cba3

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

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

require 'locomotive/steam/adapters/filesystem.rb'

describe Locomotive::Steam::Server do

  include Rack::Test::Methods

  def app
    run_server
  end

  describe 'sitemap.xml' do

    let(:now) { Time.use_zone('America/Chicago') { Time.zone.local(2015, 'mar', 25, 10, 0) } }
    let(:env) { {} }

    subject { Timecop.freeze(now) { get('/sitemap.xml', {}, env) }; last_response.body }

    before { Locomotive::Steam::Adapters::Filesystem::SimpleCacheStore.new.clear }

    it 'checks if it looks valid' do
      expect(Nokogiri::XML(subject).errors.empty?).to eq true
      expect(subject.scan(/<url>/).size).to eq 40
      expect(subject).to match("<loc>http://example.org/songs/song-number-2/band</loc>")
      expect(subject).to match((<<-EOF
  <url>
    <loc>http://example.org/fr/a-notre-sujet</loc>
    <lastmod>2015-03-25</lastmod>
    <priority>0.9</priority>
  </url>
      EOF
      ).strip)
    end

    context 'existing sitemap page' do

      let(:template)  { %{<?xml version="1.0" encoding="utf-8"?>OK</xml>} }
      let(:page)      { instance_double('Page', liquid_source: template, templatized?: false, redirect?: false, to_liquid: template, not_found?: false, response_type: 'application/xml') }
      let(:env)       { { 'steam.page' => page } }

      it 'renders the existing sitemap page' do
        expect(subject).to eq %{<?xml version="1.0" encoding="utf-8"?>OK</xml>}
      end

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotivecms_steam-1.2.1 spec/integration/server/sitemap_spec.rb
locomotivecms_steam-1.2.0 spec/integration/server/sitemap_spec.rb
locomotivecms_steam-1.2.0.rc3 spec/integration/server/sitemap_spec.rb
locomotivecms_steam-1.2.0.rc2 spec/integration/server/sitemap_spec.rb
locomotivecms_steam-1.2.0.rc1 spec/integration/server/sitemap_spec.rb