Sha256: 66dca405003f4362ba0f5ae43efc3d5ee1d42e92fa9b926ccb7cae182aefe7ed

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

require 'test_helper'

class DynamicSitemapsTest < ActiveSupport::TestCase
  setup do
    DynamicSitemaps.reset!
  end

  test "defaults" do
    assert_equal Rails.root.join("public").to_s, DynamicSitemaps.path
    assert_equal "sitemaps", DynamicSitemaps.folder
    assert_equal "sitemap.xml", DynamicSitemaps.index_file_name
    assert !DynamicSitemaps.always_generate_index
    assert_equal Rails.root.join("config", "sitemap.rb").to_s, DynamicSitemaps.config_path
    assert_equal 50000, DynamicSitemaps.per_page
    assert_equal ["production"], DynamicSitemaps.ping_environments
    assert_equal Rails.root.join("tmp", "dynamic_sitemaps").to_s, DynamicSitemaps.temp_path
  end

  test "configuration block" do
    DynamicSitemaps.configure do |config|
      config.folder = "mycustomfolder"
      config.per_page = 1234
    end

    assert_equal "mycustomfolder", DynamicSitemaps.folder
    assert_equal 1234, DynamicSitemaps.per_page
  end

  test "raises error on blank paths" do
    assert_nothing_raised do
      DynamicSitemaps.path = "/my/test/folder"
      DynamicSitemaps.folder = "my_sitemaps"
      DynamicSitemaps.config_path = "/my/config.rb"
    end

    assert_raises ArgumentError do
      DynamicSitemaps.path = ""
    end

    assert_raises ArgumentError do
      DynamicSitemaps.folder = ""
    end

    assert_raises ArgumentError do
      DynamicSitemaps.config_path = ""
    end
  end

  test "raises error when using old sitemap ping urls" do
    assert_raises RuntimeError do
      DynamicSitemaps.sitemap_ping_urls = ["http://test.com/sitemap.xml"]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dynamic_sitemaps-2.0.0 test/dynamic_sitemaps_test.rb
dynamic_sitemaps-2.0.0.beta2 test/dynamic_sitemaps_test.rb