Sha256: cbb42e1345fa73ff5bfa9913b7d3c3da390b7939070a3be6fdcf10823f5e5387

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# -*- encoding: utf-8 -*-

require_relative 'spec_helper'

describe W3Clove::Sitemap do
  before(:each) do
    @sitemap = W3Clove::Sitemap.new('http://ryanair.com/sitemap.xml')
    @sitemap.stub!(:doc).and_return(open("#{$samples_dir}/sitemap.xml"))
    MarkupValidator.any_instance.stubs(:validate_uri).returns(stubbed_validator_results)
  end

  it "should have an URL" do
    @sitemap.url.should == 'http://ryanair.com/sitemap.xml'
  end

  it "should get its pages from the xml, removing repeated urls" do
    @sitemap.pages.length.should == 3
    @sitemap.pages[0].url.should == 'http://www.ryanair.com/es/'
    @sitemap.pages[1].url.should == 'http://www.ryanair.com/es/careers/job'
    @sitemap.pages[2].url.should == 'http://www.ryanair.com/es/about'
  end

  it "should know the errors of all of its pages as a whole" do
    @sitemap.errors.length.should == 9
    @sitemap.errors.each do |e|
      e.should be_an_instance_of W3Clove::Message
      e.type.should == :error
    end
  end

  it "should know the warnings of all of its pages as a whole" do
    @sitemap.warnings.length.should == 9
    @sitemap.warnings.each do |w|
      w.should be_an_instance_of W3Clove::Message
      w.type.should == :warning
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
w3clove-0.3.5 spec/sitemap_spec.rb
w3clove-0.3.4 spec/sitemap_spec.rb
w3clove-0.3.3 spec/sitemap_spec.rb
w3clove-0.3.2 spec/sitemap_spec.rb
w3clove-0.3.1 spec/sitemap_spec.rb
w3clove-0.3.0 spec/sitemap_spec.rb
w3clove-0.2.1 spec/sitemap_spec.rb
w3clove-0.0.2 spec/sitemap_spec.rb