Skip to content

Commit

Permalink
Include top level URLs into sitemap.xml
Browse files Browse the repository at this point in the history
Signed-off-by: Ealden Esto E. Escanan <ealden@odd-e.com>
  • Loading branch information
ealden committed Apr 25, 2013
1 parent 97bb44c commit 0ec3019
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 2 deletions.
32 changes: 31 additions & 1 deletion robottests/sitemap.txt
Expand Up @@ -6,4 +6,34 @@ Test Teardown Close Browser
Should have a sitemap.xml file
${url}= Catenate SEPARATOR= ${BASE_URL} /sitemap.xml
Open Browser ${url}
Page Should Contain http://scrumprimer.org/
Page Should Contain http://scrumprimer.org/

Should have a sitemap.xml entry for /
${url}= Catenate SEPARATOR= ${BASE_URL} /sitemap.xml
Open Browser ${url}
Page Should Contain http://scrumprimer.org/

Should have a sitemap.xml entry for /translations
${url}= Catenate SEPARATOR= ${BASE_URL} /sitemap.xml
Open Browser ${url}
Page Should Contain http://scrumprimer.org/translations

Should have a sitemap.xml entry for /overview
${url}= Catenate SEPARATOR= ${BASE_URL} /sitemap.xml
Open Browser ${url}
Page Should Contain http://scrumprimer.org/overview

Should have a sitemap.xml entry for /anime
${url}= Catenate SEPARATOR= ${BASE_URL} /sitemap.xml
Open Browser ${url}
Page Should Contain http://scrumprimer.org/anime

Should have a sitemap.xml entry for /about
${url}= Catenate SEPARATOR= ${BASE_URL} /sitemap.xml
Open Browser ${url}
Page Should Contain http://scrumprimer.org/about

Should have a sitemap.xml entry for /contact
${url}= Catenate SEPARATOR= ${BASE_URL} /sitemap.xml
Open Browser ${url}
Page Should Contain http://scrumprimer.org/contact
7 changes: 6 additions & 1 deletion scrumprimer.rb
Expand Up @@ -79,7 +79,12 @@ def redirect_to_public_file(file)
end

get '/sitemap.xml' do
map = XmlSitemap::Map.new('scrumprimer.org') do
map = XmlSitemap::Map.new('scrumprimer.org') do |m|
m.add '/translations'
m.add '/overview'
m.add '/anime'
m.add '/about'
m.add '/contact'
end

headers['Content-Type'] = 'text/xml'
Expand Down
50 changes: 50 additions & 0 deletions spec/scrumprimer_sitemap_spec.rb
@@ -0,0 +1,50 @@
# encoding: utf-8

require './scrumprimer'
require 'capybara'
require 'capybara/dsl'

set :environment, :test

describe "Scrum Primer Sitemap Specs" do
include Capybara::DSL

before do
Capybara.app = ScrumPrimerApp.new
end

it 'should have a sitemap.xml file' do
visit '/sitemap.xml'
page.status_code.should == 200
end

it 'should have a sitemap.xml entry for /' do
visit '/sitemap.xml'
page.should have_content 'http://scrumprimer.org/'
end

it 'should have a sitemap.xml entry for /translations' do
visit '/sitemap.xml'
page.should have_content 'http://scrumprimer.org/translations'
end

it 'should have a sitemap.xml entry for /overview' do
visit '/sitemap.xml'
page.should have_content 'http://scrumprimer.org/overview'
end

it 'should have a sitemap.xml entry for /anime' do
visit '/sitemap.xml'
page.should have_content 'http://scrumprimer.org/anime'
end

it 'should have a sitemap.xml entry for /about' do
visit '/sitemap.xml'
page.should have_content 'http://scrumprimer.org/about'
end

it 'should have a sitemap.xml entry for /contact' do
visit '/sitemap.xml'
page.should have_content 'http://scrumprimer.org/contact'
end
end

0 comments on commit 0ec3019

Please sign in to comment.