This repository has been archived by the owner on Oct 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
sitemap_generator_test.rb
70 lines (53 loc) · 1.8 KB
/
sitemap_generator_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
require 'test/test_helper'
#
# TODO split class
#
class SitemapGeneratorTest < Test::Unit::TestCase
=begin
context "Plugin" do
should "require a valid configuration file" do
SitemapGenerator::Options.should_receive(:load_options) { false }
SitemapGenerator::Options.load_options
SitemapGenerator::Generator.run
end
end
=end
context "Generator" do
should "find ActiveRecord models that are to be included in sitemap" do
@model_path = File.join(RAILS_ROOT, 'app', 'models')
generator = SitemapGenerator::Generator.new
generator.find_models.should == [Admin::Post, Admin::Sale, Business, Post]
end
should "not allow sitemaps bigger than 10MB" do
end
should "not allow more than 50000 links per sitemap file" do
end
should "gzip sitemap" do
end
should "generate a valid XML file" do
end
should "sitemap URLs should be valid" do
end
end
context "Ping" do
# TODO cleanup
should "should ping all major search engines" do
urls = [
'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=http://aktagon.com/sitemap.xml',
'http://www.google.com/webmasters/tools/ping?sitemap=http://aktagon.com/sitemap.xml',
'http://www.bing.com/webmaster/ping.aspx?siteMap=http://aktagon.com/sitemap.xml',
'http://submissions.ask.com/ping?sitemap=http://aktagon.com/sitemap.xml'
].each do |url|
FakeWeb.register_uri(:get, url, :body => "")
end
generator = SitemapGenerator::Generator.new
generator.ping
end
should "should not ping if ping is disabled" do
generator = SitemapGenerator::Generator.new
generator.ping?.should == true
mock(SitemapGenerator::Options).ping.returns(false)
generator.ping?.should == false
end
end
end