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(//).size).to eq 40 expect(subject).to match("http://example.org/songs/song-number-2/band") expect(subject).to match((<<-EOF http://example.org/fr/a-notre-sujet 2015-03-25 0.9 EOF ).strip) end context 'existing sitemap page' do let(:template) { %{OK} } 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 %{OK} end end end end