Permalink
Browse files

Generate the correct full URL path using the URI class instead of File.

  • Loading branch information...
1 parent aca1dcb commit 07e9d449f0dc094afb197d6c49597a1c11841169 Evgeni Dzhelyov committed Mar 5, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/big_sitemap.rb
  2. +2 −2 test/big_sitemap_test.rb
View
@@ -179,7 +179,7 @@ def add_urls
with_sitemap do |builder|
@paths.each do |path, options|
- url = File.join @options[:base_url], File.path(path)
+ url = URI.join(@options[:base_url], path)
builder.add_url! url, options
end
end
@@ -44,12 +44,12 @@ def teardown
should 'should add paths' do
generate_sitemap do
add '/', {:last_modified => Time.now, :change_frequency => 'weekly', :priority => 0.5}
- add '/about', {:last_modified => Time.now, :change_frequency => 'weekly', :priority => 0.5}
+ add '/navigation/about/us', {:last_modified => Time.now, :change_frequency => 'weekly', :priority => 0.5}
end
elems = elements first_sitemap_file, 'loc'
assert_equal 'http://example.com/', elems.first.text
- assert_equal 'http://example.com/about', elems.last.text
+ assert_equal 'http://example.com/navigation/about/us', elems.last.text
end
context 'Sitemap index file' do

0 comments on commit 07e9d44

Please sign in to comment.