Sha256: edbb17e22762825a0340850bf0dd549e3e91c3cd2efbce1b0e5be53f9d022105

Contents?: true

Size: 935 Bytes

Versions: 17

Compression:

Stored size: 935 Bytes

Contents

require 'spec_helper'

describe "SitemapGenerator" do

  it "should add the mobile sitemap element" do
    loc = 'http://www.example.com/mobile_page.html'
    format = 'html'

    mobile_xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('mobile_page.html',
      :host => 'http://www.example.com',
      :mobile => true
    ).to_xml

    # Check that the options were parsed correctly
    doc = Nokogiri::XML.parse("<root xmlns:mobile='#{SitemapGenerator::SCHEMAS['mobile']}'>#{mobile_xml_fragment}</root>")
    url = doc.at_xpath("//url")
    url.should_not be_nil
    url.at_xpath("loc").text.should == loc

    mobile = url.at_xpath("mobile:mobile")
    mobile.should_not be_nil

    # Google's documentation and published schema don't match some valid elements may
    # not validate.
    xml_fragment_should_validate_against_schema(mobile, 'sitemap-mobile', 'xmlns:mobile' => SitemapGenerator::SCHEMAS['mobile'])
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
sitemap_generator-5.2.0 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.1.0 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.5 spec/sitemap_generator/mobile_sitemap_spec.rb
ftbpro_sitemap_generator-5.0.8 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator_ftbpro-5.0.6 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator_ftbpro-5.0.5 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator_ftbpro-5.0.4 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.4 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.3 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.2 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.1 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.0 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.0.beta1 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-5.0.0.beta spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-4.3.1 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-4.3.0 spec/sitemap_generator/mobile_sitemap_spec.rb
sitemap_generator-4.2.0 spec/sitemap_generator/mobile_sitemap_spec.rb