Sha256: 1127c9df9a71434977424505ae9199c6a5c63b4cf07990b4c2bca9099c585a6e

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

require 'minitest/autorun'
require_relative '../lib/middleman-robots/generator.rb'

class Test_Generator < MiniTest::Test
  def test_process
    rules = [
      {
        user_agent: 'Googlebot',
        disallow:  %w(tmp/* /something/dir/file_disallow.html),
        allow:  %w(allow/* /something/dir/file_allow.html)
      },
      {
        user_agent: 'Googlebot-Image',
        disallow:  %w(tmp/* /something/dir/file_disallow.html),
        allow:  %w(allow/* /something/dir/file_allow.html)
      }
    ]
    sitemap_uri = 'http://example.com/sitemap.xml'
    generator = Middleman::Robots::Generator.new(rules, sitemap_uri)

    expected = "User-Agent: Googlebot
Disallow: /tmp/*
Disallow: /something/dir/file_disallow.html
Allow: /allow/*
Allow: /something/dir/file_allow.html

User-Agent: Googlebot-Image
Disallow: /tmp/*
Disallow: /something/dir/file_disallow.html
Allow: /allow/*
Allow: /something/dir/file_allow.html

Sitemap: http://example.com/sitemap.xml"

    assert_equal expected, generator.process
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
middleman-robots-1.3.2 tests/test_generator.rb
middleman-robots-1.3.1 tests/test_generator.rb
middleman-robots-1.3.0 tests/test_generator.rb