Sha256: cf28e18a8e07fd9b9675f6060b9a37066b0b0b87f381f2469f47fb8daf2d6cca
Contents?: true
Size: 1.82 KB
Versions: 4
Compression:
Stored size: 1.82 KB
Contents
# encoding: utf-8 class Nanoc::Extra::Checking::Checks::InternalLinksTest < MiniTest::Unit::TestCase include Nanoc::TestHelpers def test_run with_site do |site| # Create files FileUtils.mkdir_p('output') FileUtils.mkdir_p('output/stuff') File.open('output/foo.txt', 'w') { |io| io.write('<a href="/broken">broken</a>') } File.open('output/bar.html', 'w') { |io| io.write('<a href="/foo.txt">not broken</a>') } # Create check check = Nanoc::Extra::Checking::Checks::InternalLinks.new(site) check.run # Test assert check.issues.empty? end end def test_valid? with_site do |site| # Create files FileUtils.mkdir_p('output') FileUtils.mkdir_p('output/stuff') File.open('output/origin', 'w') { |io| io.write('hi') } File.open('output/foo', 'w') { |io| io.write('hi') } File.open('output/stuff/blah', 'w') { |io| io.write('hi') } # Create check check = Nanoc::Extra::Checking::Checks::InternalLinks.new(site) # Test assert check.send(:valid?, 'foo', 'output/origin') assert check.send(:valid?, 'origin', 'output/origin') assert check.send(:valid?, 'stuff/blah', 'output/origin') assert check.send(:valid?, '/foo', 'output/origin') assert check.send(:valid?, '/origin', 'output/origin') assert check.send(:valid?, '/stuff/blah', 'output/origin') end end def test_remove_query_string with_site do |site| FileUtils.mkdir_p('output/stuff') File.open('output/stuff/right', 'w') { |io| io.write('hi') } check = Nanoc::Extra::Checking::Checks::InternalLinks.new(site) assert check.send(:valid?, 'stuff/right?foo=123', 'output/origin') refute check.send(:valid?, 'stuff/wrong?foo=123', 'output/origin') end end end
Version data entries
4 entries across 4 versions & 1 rubygems