File: test_doctor_command.rb

package info (click to toggle)
jekyll 3.1.6%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,820 kB
  • ctags: 997
  • sloc: ruby: 10,045; sh: 145; xml: 59; makefile: 28
file content (36 lines) | stat: -rw-r--r-- 1,233 bytes parent folder | download
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
require 'helper'
require 'jekyll/commands/doctor'

class TestDoctorCommand < JekyllUnitTest
  context 'urls only differ by case' do
    setup do
      clear_dest
    end

    should 'return success on a valid site/page' do
      @site = Site.new(Jekyll.configuration({
        "source" => File.join(source_dir, '/_urls_differ_by_case_valid'),
        "destination" => dest_dir
      }))
      @site.process
      output = capture_stderr do
         ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site)
         assert_equal false, ret
      end
      assert_equal "", output
    end

    should 'return warning for pages only differing by case' do
      @site = Site.new(Jekyll.configuration({
        "source" => File.join(source_dir, '/_urls_differ_by_case_invalid'),
        "destination" => dest_dir
      }))
      @site.process
      output = capture_stderr do
         ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site)
         assert_equal true, ret
      end
      assert_includes output, "Warning: The following URLs only differ by case. On a case-insensitive file system one of the URLs will be overwritten by the other: #{dest_dir}/about/index.html, #{dest_dir}/About/index.html"
    end
  end
end