ftbpro_sitemap_generator 5.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +13 -0
  3. data/Gemfile.lock +35 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +1139 -0
  6. data/Rakefile +43 -0
  7. data/VERSION +1 -0
  8. data/lib/capistrano/sitemap_generator.rb +1 -0
  9. data/lib/capistrano/tasks/sitemap_generator.cap +36 -0
  10. data/lib/sitemap_generator.rb +85 -0
  11. data/lib/sitemap_generator/adapters.rb +0 -0
  12. data/lib/sitemap_generator/adapters/file_adapter.rb +43 -0
  13. data/lib/sitemap_generator/adapters/fog_adapter.rb +28 -0
  14. data/lib/sitemap_generator/adapters/s3_adapter.rb +41 -0
  15. data/lib/sitemap_generator/adapters/wave_adapter.rb +21 -0
  16. data/lib/sitemap_generator/application.rb +49 -0
  17. data/lib/sitemap_generator/builder.rb +8 -0
  18. data/lib/sitemap_generator/builder/sitemap_file.rb +172 -0
  19. data/lib/sitemap_generator/builder/sitemap_index_file.rb +149 -0
  20. data/lib/sitemap_generator/builder/sitemap_index_url.rb +28 -0
  21. data/lib/sitemap_generator/builder/sitemap_url.rb +250 -0
  22. data/lib/sitemap_generator/core_ext.rb +3 -0
  23. data/lib/sitemap_generator/core_ext/big_decimal.rb +45 -0
  24. data/lib/sitemap_generator/core_ext/numeric.rb +48 -0
  25. data/lib/sitemap_generator/helpers/number_helper.rb +237 -0
  26. data/lib/sitemap_generator/interpreter.rb +80 -0
  27. data/lib/sitemap_generator/link_set.rb +677 -0
  28. data/lib/sitemap_generator/railtie.rb +7 -0
  29. data/lib/sitemap_generator/sitemap_location.rb +192 -0
  30. data/lib/sitemap_generator/sitemap_namer.rb +75 -0
  31. data/lib/sitemap_generator/tasks.rb +53 -0
  32. data/lib/sitemap_generator/templates.rb +41 -0
  33. data/lib/sitemap_generator/utilities.rb +181 -0
  34. data/lib/tasks/sitemap_generator_tasks.rake +1 -0
  35. data/rails/install.rb +2 -0
  36. data/rails/uninstall.rb +2 -0
  37. data/spec/blueprint.rb +15 -0
  38. data/spec/files/sitemap.create.rb +12 -0
  39. data/spec/files/sitemap.groups.rb +49 -0
  40. data/spec/sitemap_generator/adapters/s3_adapter_spec.rb +23 -0
  41. data/spec/sitemap_generator/alternate_sitemap_spec.rb +79 -0
  42. data/spec/sitemap_generator/application_spec.rb +69 -0
  43. data/spec/sitemap_generator/builder/sitemap_file_spec.rb +110 -0
  44. data/spec/sitemap_generator/builder/sitemap_index_file_spec.rb +124 -0
  45. data/spec/sitemap_generator/builder/sitemap_index_url_spec.rb +28 -0
  46. data/spec/sitemap_generator/builder/sitemap_url_spec.rb +186 -0
  47. data/spec/sitemap_generator/core_ext/bigdecimal_spec.rb +20 -0
  48. data/spec/sitemap_generator/core_ext/numeric_spec.rb +43 -0
  49. data/spec/sitemap_generator/file_adaptor_spec.rb +20 -0
  50. data/spec/sitemap_generator/geo_sitemap_spec.rb +30 -0
  51. data/spec/sitemap_generator/helpers/number_helper_spec.rb +196 -0
  52. data/spec/sitemap_generator/interpreter_spec.rb +90 -0
  53. data/spec/sitemap_generator/link_set_spec.rb +864 -0
  54. data/spec/sitemap_generator/mobile_sitemap_spec.rb +27 -0
  55. data/spec/sitemap_generator/news_sitemap_spec.rb +42 -0
  56. data/spec/sitemap_generator/pagemap_sitemap_spec.rb +57 -0
  57. data/spec/sitemap_generator/sitemap_generator_spec.rb +582 -0
  58. data/spec/sitemap_generator/sitemap_groups_spec.rb +144 -0
  59. data/spec/sitemap_generator/sitemap_location_spec.rb +210 -0
  60. data/spec/sitemap_generator/sitemap_namer_spec.rb +96 -0
  61. data/spec/sitemap_generator/templates_spec.rb +24 -0
  62. data/spec/sitemap_generator/utilities/existence_spec.rb +26 -0
  63. data/spec/sitemap_generator/utilities/hash_spec.rb +57 -0
  64. data/spec/sitemap_generator/utilities/rounding_spec.rb +31 -0
  65. data/spec/sitemap_generator/utilities_spec.rb +101 -0
  66. data/spec/sitemap_generator/video_sitemap_spec.rb +117 -0
  67. data/spec/spec_helper.rb +24 -0
  68. data/spec/support/file_macros.rb +39 -0
  69. data/spec/support/schemas/siteindex.xsd +73 -0
  70. data/spec/support/schemas/sitemap-geo.xsd +41 -0
  71. data/spec/support/schemas/sitemap-mobile.xsd +32 -0
  72. data/spec/support/schemas/sitemap-news.xsd +159 -0
  73. data/spec/support/schemas/sitemap-pagemap.xsd +97 -0
  74. data/spec/support/schemas/sitemap-video.xsd +643 -0
  75. data/spec/support/schemas/sitemap.xsd +115 -0
  76. data/spec/support/xml_macros.rb +67 -0
  77. data/templates/sitemap.rb +27 -0
  78. metadata +226 -0
@@ -0,0 +1 @@
1
+ load(File.expand_path(File.join(File.dirname(__FILE__), '../sitemap_generator/tasks.rb')))
data/rails/install.rb ADDED
@@ -0,0 +1,2 @@
1
+ # Install hook code here
2
+ SitemapGenerator::Utilities.install_sitemap_rb
@@ -0,0 +1,2 @@
1
+ # Uninstall hook code here
2
+ SitemapGenerator::Utilities.uninstall_sitemap_rb
data/spec/blueprint.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'machinist/active_record'
2
+ require 'sham'
3
+
4
+ Sham.title { Time.now.to_i }
5
+ Content.blueprint do
6
+ title
7
+ end
8
+
9
+ module Blueprint
10
+ def self.seed
11
+ 14.times do |i|
12
+ content = Content.make(:title => "Link #{i}")
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ SitemapGenerator::Sitemap.default_host = "http://www.example.com"
2
+
3
+ SitemapGenerator::Sitemap.create do
4
+ add '/contents', :priority => 0.7, :changefreq => 'daily'
5
+
6
+ # add all individual articles
7
+ (1..10).each do |i|
8
+ add "/content/#{i}"
9
+ end
10
+
11
+ add "/merchant_path", :host => "https://www.example.com"
12
+ end
@@ -0,0 +1,49 @@
1
+ SitemapGenerator::Sitemap.default_host = "http://www.example.com"
2
+
3
+ SitemapGenerator::Sitemap.create(
4
+ :include_root => true, :include_index => true,
5
+ :filename => :new_sitemaps, :sitemaps_path => 'fr/') do
6
+
7
+ add('/one', :priority => 0.7, :changefreq => 'daily')
8
+
9
+ # Test a new location and filename and sitemaps host
10
+ group(:sitemaps_path => 'en/', :filename => :xxx,
11
+ :sitemaps_host => "http://newhost.com") do
12
+
13
+ add '/two'
14
+ add '/three'
15
+ end
16
+
17
+ # Test a simple namer.
18
+ group(:namer => SitemapGenerator::SimpleNamer.new(:abc, :start => 4, :zero => 3)) do
19
+ add '/four'
20
+ add '/five'
21
+ add '/six'
22
+ end
23
+
24
+ # Test a simple namer
25
+ group(:namer => SitemapGenerator::SimpleNamer.new(:def)) do
26
+ add '/four'
27
+ add '/five'
28
+ add '/six'
29
+ end
30
+
31
+ add '/seven'
32
+
33
+ # This should be in a file of its own.
34
+ # Not technically valid to have a link with a different host, but people like
35
+ # to do strange things sometimes.
36
+ group(:sitemaps_host => "http://exceptional.com") do
37
+ add '/eight'
38
+ add '/nine'
39
+ end
40
+
41
+ add '/ten'
42
+
43
+ # This should have no effect. Already added default links.
44
+ group(:include_root => true, :include_index => true) {}
45
+
46
+ # Not technically valid to have a link with a different host, but people like
47
+ # to do strange things sometimes
48
+ add "/merchant_path", :host => "https://www.merchanthost.com"
49
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ # Don't run this test as part of the unit testing suite as we don't want
6
+ # Fog to be a dependency of SitemapGenerator core. This is an integration
7
+ # test. Unfortunately it doesn't really test much, so its usefullness is
8
+ # questionable.
9
+ describe 'SitemapGenerator::S3Adapter', :integration => true do
10
+
11
+ let(:location) { SitemapGenerator::SitemapLocation.new(:namer => SitemapGenerator::SitemapNamer.new(:sitemap), :public_path => 'tmp/', :sitemaps_path => 'test/', :host => 'http://example.com/') }
12
+ let(:directory) { stub(:files => stub(:create)) }
13
+ let(:directories) { stub(:directories => stub(:new => directory)) }
14
+
15
+ before do
16
+ SitemapGenerator::S3Adapter # eager load
17
+ Fog::Storage.stubs(:new => directories)
18
+ end
19
+
20
+ it 'should create the file in S3 with a single operation' do
21
+ subject.write(location, 'payload')
22
+ end
23
+ end
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe "SitemapGenerator" do
4
+ it "should not include media element unless provided" do
5
+ xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('link_with_alternates.html',
6
+ :host => 'http://www.example.com',
7
+ :alternates => [
8
+ {
9
+ :lang => 'de',
10
+ :href => 'http://www.example.de/link_with_alternate.html'
11
+ }
12
+ ]
13
+ ).to_xml
14
+
15
+ doc = Nokogiri::XML.parse("<root xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:xhtml='http://www.w3.org/1999/xhtml'>#{xml_fragment}</root>")
16
+ url = doc.css('url')
17
+ url.should_not be_nil
18
+ url.css('loc').text.should == 'http://www.example.com/link_with_alternates.html'
19
+
20
+ alternate = url.at_xpath('xhtml:link')
21
+ alternate.should_not be_nil
22
+ alternate.attribute('rel').value.should == 'alternate'
23
+ alternate.attribute('hreflang').value.should == 'de'
24
+ alternate.attribute('media').should be_nil
25
+ end
26
+
27
+ it "should add alternate links to sitemap" do
28
+ xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('link_with_alternates.html',
29
+ :host => 'http://www.example.com',
30
+ :alternates => [
31
+ {
32
+ :lang => 'de',
33
+ :href => 'http://www.example.de/link_with_alternate.html',
34
+ :media => 'only screen and (max-width: 640px)'
35
+ }
36
+ ]
37
+ ).to_xml
38
+
39
+ doc = Nokogiri::XML.parse("<root xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:xhtml='http://www.w3.org/1999/xhtml'>#{xml_fragment}</root>")
40
+ url = doc.css('url')
41
+ url.should_not be_nil
42
+ url.css('loc').text.should == 'http://www.example.com/link_with_alternates.html'
43
+
44
+ alternate = url.at_xpath('xhtml:link')
45
+ alternate.should_not be_nil
46
+ alternate.attribute('rel').value.should == 'alternate'
47
+ alternate.attribute('hreflang').value.should == 'de'
48
+ alternate.attribute('href').value.should == 'http://www.example.de/link_with_alternate.html'
49
+ alternate.attribute('media').value.should == 'only screen and (max-width: 640px)'
50
+ end
51
+
52
+ it "should add alternate links to sitemap with rel nofollow" do
53
+ xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('link_with_alternates.html',
54
+ :host => 'http://www.example.com',
55
+ :alternates => [
56
+ {
57
+ :lang => 'de',
58
+ :href => 'http://www.example.de/link_with_alternate.html',
59
+ :nofollow => true,
60
+ :media => 'only screen and (max-width: 640px)'
61
+ }
62
+ ]
63
+ ).to_xml
64
+
65
+ doc = Nokogiri::XML.parse("<root xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:xhtml='http://www.w3.org/1999/xhtml'>#{xml_fragment}</root>")
66
+ url = doc.css('url')
67
+ url.should_not be_nil
68
+ url.css('loc').text.should == 'http://www.example.com/link_with_alternates.html'
69
+
70
+ alternate = url.at_xpath('xhtml:link')
71
+ alternate.should_not be_nil
72
+ alternate.attribute('rel').value.should == 'alternate nofollow'
73
+ alternate.attribute('hreflang').value.should == 'de'
74
+ alternate.attribute('href').value.should == 'http://www.example.de/link_with_alternate.html'
75
+ alternate.attribute('media').value.should == 'only screen and (max-width: 640px)'
76
+ end
77
+
78
+ end
79
+
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe SitemapGenerator::Application do
4
+ before :all do
5
+ SitemapGenerator::Utilities.with_warnings(nil) do
6
+ Object.const_set(:Rails, Object.new)
7
+ end
8
+ end
9
+
10
+ after :all do
11
+ SitemapGenerator::Utilities.with_warnings(nil) do
12
+ Object.const_set(:Rails, nil)
13
+ end
14
+ end
15
+
16
+ before :each do
17
+ @app = SitemapGenerator::Application.new
18
+ end
19
+
20
+ describe "rails3?" do
21
+ tests = {
22
+ :nil => false,
23
+ '2.3.11' => false,
24
+ '3.0.1' => true,
25
+ '3.0.11' => true
26
+ }
27
+
28
+ it "should identify the rails version correctly" do
29
+ tests.each do |version, result|
30
+ Rails.expects(:version).returns(version)
31
+ @app.rails3?.should == result
32
+ end
33
+ end
34
+ end
35
+
36
+ describe "with Rails" do
37
+ before :each do
38
+ @root = '/test'
39
+ Rails.expects(:root).returns(@root).at_least_once
40
+ end
41
+
42
+ it "should use the Rails.root" do
43
+ @app.root.should be_a(Pathname)
44
+ @app.root.to_s.should == @root
45
+ (@app.root + 'public/').to_s.should == File.join(@root, 'public/')
46
+ end
47
+ end
48
+
49
+ describe "with no Rails" do
50
+ before :each do
51
+ @rails = Rails
52
+ Object.send(:remove_const, :Rails)
53
+ end
54
+
55
+ after :each do
56
+ Object::Rails = @rails
57
+ end
58
+
59
+ it "should not be Rails" do
60
+ @app.rails?.should be_false
61
+ end
62
+
63
+ it "should use the current working directory" do
64
+ @app.root.should be_a(Pathname)
65
+ @app.root.to_s.should == Dir.getwd
66
+ (@app.root + 'public/').to_s.should == File.join(Dir.getwd, 'public/')
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,110 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'SitemapGenerator::Builder::SitemapFile' do
4
+ let(:location) { SitemapGenerator::SitemapLocation.new(:namer => SitemapGenerator::SimpleNamer.new(:sitemap, :start => 2, :zero => 1), :public_path => 'tmp/', :sitemaps_path => 'test/', :host => 'http://example.com/') }
5
+ let(:sitemap) { SitemapGenerator::Builder::SitemapFile.new(location) }
6
+
7
+ it "should have a default namer" do
8
+ sitemap = SitemapGenerator::Builder::SitemapFile.new
9
+ sitemap.location.filename.should == 'sitemap1.xml.gz'
10
+ end
11
+
12
+ it "should return the name of the sitemap file" do
13
+ sitemap.location.filename.should == 'sitemap1.xml.gz'
14
+ end
15
+
16
+ it "should return the URL" do
17
+ sitemap.location.url.should == 'http://example.com/test/sitemap1.xml.gz'
18
+ end
19
+
20
+ it "should return the path" do
21
+ sitemap.location.path.should == File.expand_path('tmp/test/sitemap1.xml.gz')
22
+ end
23
+
24
+ it "should be empty" do
25
+ sitemap.empty?.should be_true
26
+ sitemap.link_count.should == 0
27
+ end
28
+
29
+ it "should not be finalized" do
30
+ sitemap.finalized?.should be_false
31
+ end
32
+
33
+ it "should raise if no default host is set" do
34
+ lambda { SitemapGenerator::Builder::SitemapFile.new.location.url }.should raise_error(SitemapGenerator::SitemapError)
35
+ end
36
+
37
+ describe "lastmod" do
38
+ it "should be the file last modified time" do
39
+ lastmod = (Time.now - 1209600)
40
+ sitemap.location.reserve_name
41
+ File.expects(:mtime).with(sitemap.location.path).returns(lastmod)
42
+ sitemap.lastmod.should == lastmod
43
+ end
44
+
45
+ it "should be nil if the location has not reserved a name" do
46
+ File.expects(:mtime).never
47
+ sitemap.lastmod.should be_nil
48
+ end
49
+
50
+ it "should be nil if location has reserved a name and the file DNE" do
51
+ sitemap.location.reserve_name
52
+ File.expects(:mtime).raises(Errno::ENOENT)
53
+ sitemap.lastmod.should be_nil
54
+ end
55
+ end
56
+
57
+ describe "new" do
58
+ let(:original_sitemap) { sitemap }
59
+ let(:new_sitemap) { sitemap.new }
60
+
61
+ before :each do
62
+ original_sitemap
63
+ new_sitemap
64
+ end
65
+
66
+ it "should inherit the same options" do
67
+ # The name is the same because the original sitemap was not finalized
68
+ new_sitemap.location.url.should == 'http://example.com/test/sitemap1.xml.gz'
69
+ new_sitemap.location.path.should == File.expand_path('tmp/test/sitemap1.xml.gz')
70
+ end
71
+
72
+ it "should not share the same location instance" do
73
+ new_sitemap.location.should_not be(original_sitemap.location)
74
+ end
75
+
76
+ it "should inherit the same namer instance" do
77
+ new_sitemap.location.namer.should == original_sitemap.location.namer
78
+ end
79
+ end
80
+
81
+ describe "reserve_name" do
82
+ it "should reserve the name from the location" do
83
+ sitemap.reserved_name?.should be_false
84
+ sitemap.location.expects(:reserve_name).returns('name')
85
+ sitemap.reserve_name
86
+ sitemap.reserved_name?.should be_true
87
+ sitemap.instance_variable_get(:@reserved_name).should == 'name'
88
+ end
89
+
90
+ it "should be safe to call multiple times" do
91
+ sitemap.location.expects(:reserve_name).returns('name').once
92
+ sitemap.reserve_name
93
+ sitemap.reserve_name
94
+ end
95
+ end
96
+
97
+ describe "add" do
98
+ it "should use the host provided" do
99
+ url = SitemapGenerator::Builder::SitemapUrl.new('/one', :host => 'http://newhost.com/')
100
+ SitemapGenerator::Builder::SitemapUrl.expects(:new).with('/one', :host => 'http://newhost.com').returns(url)
101
+ sitemap.add '/one', :host => 'http://newhost.com'
102
+ end
103
+
104
+ it "should use the host from the location" do
105
+ url = SitemapGenerator::Builder::SitemapUrl.new('/one', :host => 'http://example.com/')
106
+ SitemapGenerator::Builder::SitemapUrl.expects(:new).with('/one', :host => 'http://example.com/').returns(url)
107
+ sitemap.add '/one'
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,124 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'SitemapGenerator::Builder::SitemapIndexFile' do
4
+ let(:location) { SitemapGenerator::SitemapLocation.new(:filename => 'sitemap.xml.gz', :public_path => '/public/', :host => 'http://example.com/') }
5
+ let(:index) { SitemapGenerator::Builder::SitemapIndexFile.new(location) }
6
+
7
+ before :each do
8
+ index.location[:sitemaps_path] = 'test/'
9
+ end
10
+
11
+ it "should return the URL" do
12
+ index.location.url.should == 'http://example.com/test/sitemap.xml.gz'
13
+ end
14
+
15
+ it "should return the path" do
16
+ index.location.path.should == '/public/test/sitemap.xml.gz'
17
+ end
18
+
19
+ it "should be empty" do
20
+ index.empty?.should be_true
21
+ index.link_count.should == 0
22
+ end
23
+
24
+ it "should not have a last modification data" do
25
+ index.lastmod.should be_nil
26
+ end
27
+
28
+ it "should not be finalized" do
29
+ index.finalized?.should be_false
30
+ end
31
+
32
+ it "filename should be set" do
33
+ index.location.filename.should == 'sitemap.xml.gz'
34
+ end
35
+
36
+ it "should have a default namer" do
37
+ index = SitemapGenerator::Builder::SitemapIndexFile.new
38
+ index.location.filename.should == 'sitemap.xml.gz'
39
+ end
40
+
41
+ describe "link_count" do
42
+ it "should return the link count" do
43
+ index.instance_variable_set(:@link_count, 10)
44
+ index.link_count.should == 10
45
+ end
46
+ end
47
+
48
+ describe "create_index?" do
49
+ it "should return false" do
50
+ index.location[:create_index] = false
51
+ index.create_index?.should be_false
52
+
53
+ index.instance_variable_set(:@link_count, 10)
54
+ index.create_index?.should be_false
55
+ end
56
+
57
+ it "should return true" do
58
+ index.location[:create_index] = true
59
+ index.create_index?.should be_true
60
+
61
+ index.instance_variable_set(:@link_count, 1)
62
+ index.create_index?.should be_true
63
+ end
64
+
65
+ it "when :auto, should be true if more than one link" do
66
+ index.instance_variable_set(:@link_count, 1)
67
+ index.location[:create_index] = :auto
68
+ index.create_index?.should be_false
69
+
70
+ index.instance_variable_set(:@link_count, 2)
71
+ index.create_index?.should be_true
72
+ end
73
+ end
74
+
75
+ describe "add" do
76
+ it "should use the host provided" do
77
+ url = SitemapGenerator::Builder::SitemapIndexUrl.new('/one', :host => 'http://newhost.com/')
78
+ SitemapGenerator::Builder::SitemapIndexUrl.expects(:new).with('/one', :host => 'http://newhost.com').returns(url)
79
+ index.add '/one', :host => 'http://newhost.com'
80
+ end
81
+
82
+ it "should use the host from the location" do
83
+ url = SitemapGenerator::Builder::SitemapIndexUrl.new('/one', :host => 'http://example.com/')
84
+ SitemapGenerator::Builder::SitemapIndexUrl.expects(:new).with('/one', :host => 'http://example.com/').returns(url)
85
+ index.add '/one'
86
+ end
87
+
88
+ describe "when adding manually" do
89
+ it "should reserve a name" do
90
+ index.expects(:reserve_name)
91
+ index.add '/link'
92
+ end
93
+
94
+ it "should create index" do
95
+ index.create_index?.should be_false
96
+ index.add '/one'
97
+ index.create_index?.should be_true
98
+ end
99
+ end
100
+ end
101
+
102
+ describe "index_url" do
103
+ it "when not creating an index, should be the first sitemap url" do
104
+ index.instance_variable_set(:@create_index, false)
105
+ index.instance_variable_set(:@first_sitemap_url, 'http://test.com/index.xml')
106
+ index.create_index?.should be_false
107
+ index.index_url.should == 'http://test.com/index.xml'
108
+ end
109
+
110
+ it "if there's no first sitemap url, should default to the index location url" do
111
+ index.instance_variable_set(:@create_index, false)
112
+ index.instance_variable_set(:@first_sitemap_url, nil)
113
+ index.create_index?.should be_false
114
+ index.index_url.should == index.location.url
115
+ index.index_url.should == 'http://example.com/test/sitemap.xml.gz'
116
+ end
117
+
118
+ it "when creating an index, should be the index location url" do
119
+ index.instance_variable_set(:@create_index, true)
120
+ index.index_url.should == index.location.url
121
+ index.index_url.should == 'http://example.com/test/sitemap.xml.gz'
122
+ end
123
+ end
124
+ end