Sha256: 8cb53a20f9e8ab9b0a1c55c886ff6e1220e5f2e2cbbbd12e9c798349f885e8a2

Contents?: true

Size: 978 Bytes

Versions: 12

Compression:

Stored size: 978 Bytes

Contents

require 'spec_helper'

describe "SitemapGenerator" do

  it "should add the geo sitemap element" do
    loc = 'http://www.example.com/geo_page.kml'
    format = 'kml'

    geo_xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('geo_page.kml',
      :host => 'http://www.example.com',
      :geo => {
        :format => format
      }
    ).to_xml

    # Check that the options were parsed correctly
    doc = Nokogiri::XML.parse("<root xmlns:geo='http://www.google.com/geo/schemas/sitemap/1.0'>#{geo_xml_fragment}</root>")
    url = doc.at_xpath("//url")
    url.should_not be_nil
    url.at_xpath("loc").text.should == loc

    geo = url.at_xpath("geo:geo")
    geo.should_not be_nil
    geo.at_xpath("geo:format").text.should == format

    # Google's documentation and published schema don't match some valid elements may
    # not validate.
    xml_fragment_should_validate_against_schema(geo, 'http://www.google.com/geo/schemas/sitemap/1.0', 'sitemap-geo')
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sitemap_generator-4.1.1 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-4.1.0 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-4.0.1 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-4.0 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-4.0.alpha spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-3.4 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-3.3 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-3.2.1 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-3.2 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-3.1.1 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-3.1.0 spec/sitemap_generator/geo_sitemap_spec.rb
sitemap_generator-3.0.0 spec/sitemap_generator/geo_sitemap_spec.rb