Skip to content

Commit

Permalink
Hydra behaves differently
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Jun 24, 2021
1 parent d13a5b6 commit 20f6cf1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/htmlproofer
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Mercenary.program(:htmlproofer) do |p|
options[:validation][:report_mismatched_tags] = opts['report_mismatched_tags'] unless opts['report_mismatched_tags'].nil?

options[:typhoeus] = HTMLProofer::Configuration.parse_json_option('typhoeus_config', opts['typhoeus_config'], symbolize_names: false) unless opts['typhoeus_config'].nil?
options[:hydra] = HTMLProofer::Configuration.parse_json_option('hydra_config', opts['hydra_config'], symbolize_names: false) unless opts['hydra_config'].nil?
options[:hydra] = HTMLProofer::Configuration.parse_json_option('hydra_config', opts['hydra_config']) unless opts['hydra_config'].nil?

unless opts['timeframe'].nil?
options[:cache] ||= {}
Expand Down
7 changes: 6 additions & 1 deletion spec/html-proofer/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,17 @@
end

# VCR doesn't work with bins, for some reason; parse STDOUT, ugh
skip 'has only one UA [does not work in CI]' do
it 'has only one UA' do
http = make_bin(%|--typhoeus-config='{"verbose":true,"headers":{"User-Agent":"Mozilla/5.0 (Macintosh; My New User-Agent)"}}' --as-links https://linkedin.com|)
expect(http.scan(/User-Agent: Typhoeus/).count).to eq 0
expect(http.scan(%r{User-Agent: Mozilla/5.0 \(Macintosh; My New User-Agent\)}).count).to eq 2
end

it 'accepts hydra max_concurrency' do
http = make_bin(%(--hydra-config '{"max_concurrency": 5}' http://www.github.com --as-links))
expect(http.scan(/max_concurrency is invalid/).count).to eq 0
end

it 'navigates above itself in a subdirectory' do
real_link = "#{FIXTURES_DIR}/links/root_folder/documentation-from-my-project/"
output = make_bin("--root-dir #{FIXTURES_DIR}/links/root_folder/ #{real_link}")
Expand Down
2 changes: 1 addition & 1 deletion spec/html-proofer/fixtures/cache/.runner.log
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"https://www.github.com":{"time":"2021-03-04 07:54:18 -0500","filenames":["spec/html-proofer/fixtures/links/_site/folder.html/index.html"],"status":200,"message":""}}
{"https://www.github.com":{"time":"2021-06-24 10:32:27 -0400","filenames":["spec/html-proofer/fixtures/links/_site/folder.html/index.html"],"status":200,"message":""}}

0 comments on commit 20f6cf1

Please sign in to comment.