html-proofer 2.5.1 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/htmlproof +11 -1
- data/lib/html/proofer.rb +1 -0
- data/lib/html/proofer/check_runner.rb +1 -1
- data/lib/html/proofer/checkable.rb +2 -2
- data/lib/html/proofer/checks/links.rb +2 -0
- data/lib/html/proofer/url_validator.rb +14 -3
- data/lib/html/proofer/version.rb +1 -1
- metadata +4 -344
- data/.gitignore +0 -26
- data/.travis.yml +0 -14
- data/Gemfile +0 -3
- data/LICENSE.txt +0 -22
- data/README.md +0 -276
- data/Rakefile +0 -21
- data/html-proofer.gemspec +0 -32
- data/script/bootstrap +0 -5
- data/spec/html/proofer/checkable_spec.rb +0 -47
- data/spec/html/proofer/command_spec.rb +0 -88
- data/spec/html/proofer/favicon_spec.rb +0 -47
- data/spec/html/proofer/fixtures/favicon/favicon_absent.html +0 -4
- data/spec/html/proofer/fixtures/favicon/favicon_absent_apple.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_broken.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_broken_but_ignored.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_present.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_present_shortcut.html +0 -7
- data/spec/html/proofer/fixtures/html/div_inside_head.html +0 -6
- data/spec/html/proofer/fixtures/html/html5_tags.html +0 -9
- data/spec/html/proofer/fixtures/html/ignore_script_embeds.html +0 -3
- data/spec/html/proofer/fixtures/html/invalid_tag.html +0 -3
- data/spec/html/proofer/fixtures/html/missing_closing_quotes.html +0 -5
- data/spec/html/proofer/fixtures/html/opening_and_ending_tag_mismatch.html +0 -7
- data/spec/html/proofer/fixtures/html/svg_elements.html +0 -729
- data/spec/html/proofer/fixtures/html/unescaped_ampersand_in_attribute.html +0 -4
- data/spec/html/proofer/fixtures/html/unmatched_end_tag.html +0 -5
- data/spec/html/proofer/fixtures/images/emptyImageAltText.html +0 -10
- data/spec/html/proofer/fixtures/images/existingImageExternal.html +0 -9
- data/spec/html/proofer/fixtures/images/gpl.png +0 -0
- data/spec/html/proofer/fixtures/images/ignorableAltViaOptions.html +0 -13
- data/spec/html/proofer/fixtures/images/ignorableImages.html +0 -10
- data/spec/html/proofer/fixtures/images/ignoreAltButNotLink.html +0 -13
- data/spec/html/proofer/fixtures/images/image_missing_protocol_invalid.html +0 -9
- data/spec/html/proofer/fixtures/images/image_missing_protocol_valid.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageAlt.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageAltText.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageExternal.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageInternal.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageSrc.html +0 -9
- data/spec/html/proofer/fixtures/images/relativeToSelf.html +0 -2
- data/spec/html/proofer/fixtures/images/rootRelativeImages.html +0 -2
- data/spec/html/proofer/fixtures/images/srcSetCheck.html +0 -7
- data/spec/html/proofer/fixtures/images/srcSetIgnorable.html +0 -13
- data/spec/html/proofer/fixtures/images/srcSetMissingAlt.html +0 -7
- data/spec/html/proofer/fixtures/images/srcSetMissingImage.html +0 -7
- data/spec/html/proofer/fixtures/images/terribleImageName.html +0 -9
- data/spec/html/proofer/fixtures/images/workingDataURIImage.html +0 -3
- data/spec/html/proofer/fixtures/links/_site/folder.html/index.html +0 -1
- data/spec/html/proofer/fixtures/links/anchors_in_pre.html +0 -12
- data/spec/html/proofer/fixtures/links/attributeWithDash.html +0 -8
- data/spec/html/proofer/fixtures/links/blank_mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/blank_tel_link.html +0 -9
- data/spec/html/proofer/fixtures/links/brokenHashExternal.html +0 -11
- data/spec/html/proofer/fixtures/links/brokenHashInternal.html +0 -14
- data/spec/html/proofer/fixtures/links/brokenHashOnTheWeb.html +0 -2
- data/spec/html/proofer/fixtures/links/brokenInternalLink.html +0 -0
- data/spec/html/proofer/fixtures/links/brokenLinkExternal.html +0 -11
- data/spec/html/proofer/fixtures/links/brokenLinkInternal.html +0 -10
- data/spec/html/proofer/fixtures/links/brokenLinkWithNumber.html +0 -8
- data/spec/html/proofer/fixtures/links/brokenUnixLinks.html +0 -5
- data/spec/html/proofer/fixtures/links/broken_hash_with_query.html +0 -9
- data/spec/html/proofer/fixtures/links/checkSSLLinks.html +0 -1
- data/spec/html/proofer/fixtures/links/check_just_once.html +0 -8
- data/spec/html/proofer/fixtures/links/ensure_typhoeus_options.html +0 -1
- data/spec/html/proofer/fixtures/links/erstiebegr%C3%BC%C3%9Fung.html +0 -0
- data/spec/html/proofer/fixtures/links/erstiebegr/303/274/303/237ung.html +0 -0
- data/spec/html/proofer/fixtures/links/escape_pipes.html +0 -9
- data/spec/html/proofer/fixtures/links/file.foo +0 -11
- data/spec/html/proofer/fixtures/links/folder-php/index.php +0 -2
- data/spec/html/proofer/fixtures/links/folder/anchorLink.html +0 -0
- data/spec/html/proofer/fixtures/links/folder/assets/barrel.png +0 -0
- data/spec/html/proofer/fixtures/links/folder/index.html +0 -0
- data/spec/html/proofer/fixtures/links/folder/multiples/catalog/file.html +0 -8
- data/spec/html/proofer/fixtures/links/folder/multiples/javadoc/file.html +0 -8
- data/spec/html/proofer/fixtures/links/folder/relativeImage.html +0 -2
- data/spec/html/proofer/fixtures/links/githubHash.html +0 -1
- data/spec/html/proofer/fixtures/links/gpl.png +0 -0
- data/spec/html/proofer/fixtures/links/hashReferringToSelf.html +0 -44
- data/spec/html/proofer/fixtures/links/head_link_href.html +0 -7
- data/spec/html/proofer/fixtures/links/head_link_href_absent.html +0 -7
- data/spec/html/proofer/fixtures/links/head_link_href_empty.html +0 -7
- data/spec/html/proofer/fixtures/links/ignorableLinks.html +0 -13
- data/spec/html/proofer/fixtures/links/ignorableLinksViaOptions.html +0 -13
- data/spec/html/proofer/fixtures/links/ignores_cases.html +0 -3
- data/spec/html/proofer/fixtures/links/invalid_mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/javascript_link.html +0 -9
- data/spec/html/proofer/fixtures/links/linkToFolder.html +0 -9
- data/spec/html/proofer/fixtures/links/linkTranslatedViaHrefSwap.html +0 -9
- data/spec/html/proofer/fixtures/links/linkWithHttps.html +0 -9
- data/spec/html/proofer/fixtures/links/linkWithRedirect.html +0 -14
- data/spec/html/proofer/fixtures/links/link_directory_without_slash.html +0 -1
- data/spec/html/proofer/fixtures/links/link_missing_protocol_invalid.html +0 -9
- data/spec/html/proofer/fixtures/links/link_missing_protocol_valid.html +0 -9
- data/spec/html/proofer/fixtures/links/link_pointing_to_directory.html +0 -1
- data/spec/html/proofer/fixtures/links/links_in_pre.html +0 -13
- data/spec/html/proofer/fixtures/links/mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/missingLinkHref.html +0 -9
- data/spec/html/proofer/fixtures/links/multipleProblems.html +0 -11
- data/spec/html/proofer/fixtures/links/nodupe.html +0 -1
- data/spec/html/proofer/fixtures/links/non_standard_characters.html +0 -10
- data/spec/html/proofer/fixtures/links/notarealhash.html +0 -0
- data/spec/html/proofer/fixtures/links/other_protocols.html +0 -4
- data/spec/html/proofer/fixtures/links/placeholder_with_empty_id.html +0 -1
- data/spec/html/proofer/fixtures/links/placeholder_with_id.html +0 -1
- data/spec/html/proofer/fixtures/links/placeholder_with_name.html +0 -1
- data/spec/html/proofer/fixtures/links/redirected_error.html +0 -1
- data/spec/html/proofer/fixtures/links/relativeLinks.html +0 -4
- data/spec/html/proofer/fixtures/links/rootLink/folder/index.html +0 -1
- data/spec/html/proofer/fixtures/links/rootLink/index.html +0 -1
- data/spec/html/proofer/fixtures/links/rootLink/rootLink.html +0 -9
- data/spec/html/proofer/fixtures/links/tel_link.html +0 -9
- data/spec/html/proofer/fixtures/links/urlencoded-href.html +0 -2
- data/spec/html/proofer/fixtures/links/utf8Link.html +0 -2
- data/spec/html/proofer/fixtures/resources/Screen Shot 2012-08-09 at 7.51.18 AM.png +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/getting-good-with-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/pro-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/version-control-with-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/nestedRelativeImages.html +0 -5
- data/spec/html/proofer/fixtures/resources/gpl.png +0 -0
- data/spec/html/proofer/fixtures/scripts/ignorableLinksViaOptions.html +0 -4
- data/spec/html/proofer/fixtures/scripts/script.js +0 -1
- data/spec/html/proofer/fixtures/scripts/script_broken_external.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_content.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_content_absent.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_in_pre.html +0 -5
- data/spec/html/proofer/fixtures/scripts/script_missing_internal.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_valid_internal.html +0 -9
- data/spec/html/proofer/fixtures/sorting/issue/broken_image_one.html +0 -1
- data/spec/html/proofer/fixtures/sorting/issue/broken_image_two.html +0 -4
- data/spec/html/proofer/fixtures/sorting/path/multiple_issues.html +0 -11
- data/spec/html/proofer/fixtures/sorting/path/single_issue.html +0 -1
- data/spec/html/proofer/fixtures/sorting/status/a_404.html +0 -1
- data/spec/html/proofer/fixtures/sorting/status/broken_link.html +0 -3
- data/spec/html/proofer/fixtures/sorting/status/missing_redirect.html +0 -1
- data/spec/html/proofer/fixtures/utils/lang-jp.html +0 -1
- data/spec/html/proofer/fixtures/vcr_cassettes/images/existingImageExternal_html.yml +0 -62
- data/spec/html/proofer/fixtures/vcr_cassettes/images/ignoreAltButNotLink_html_alt_ignore_/_/_.yml +0 -45
- data/spec/html/proofer/fixtures/vcr_cassettes/images/image_missing_protocol_invalid_html.yml +0 -117
- data/spec/html/proofer/fixtures/vcr_cassettes/images/image_missing_protocol_valid_html.yml +0 -62
- data/spec/html/proofer/fixtures/vcr_cassettes/images/missingImageExternal_html.yml +0 -45
- data/spec/html/proofer/fixtures/vcr_cassettes/links/attributeWithDash_html.yml +0 -73
- data/spec/html/proofer/fixtures/vcr_cassettes/links/brokenHashOnTheWeb_html.yml +0 -56
- data/spec/html/proofer/fixtures/vcr_cassettes/links/brokenHashOnTheWeb_html_check_external_hash_true_.yml +0 -719
- data/spec/html/proofer/fixtures/vcr_cassettes/links/brokenHashOnTheWeb_html_only_4xx_true_.yml +0 -56
- data/spec/html/proofer/fixtures/vcr_cassettes/links/brokenLinkExternal_html.yml +0 -96
- data/spec/html/proofer/fixtures/vcr_cassettes/links/brokenUnixLinks_html.yml +0 -156
- data/spec/html/proofer/fixtures/vcr_cassettes/links/checkSSLLinks_html.yml +0 -50
- data/spec/html/proofer/fixtures/vcr_cassettes/links/check_just_once_html.yml +0 -87
- data/spec/html/proofer/fixtures/vcr_cassettes/links/ensure_typhoeus_options_html_typhoeus_ssl_verifypeer_false_.yml +0 -40
- data/spec/html/proofer/fixtures/vcr_cassettes/links/escape_pipes_html.yml +0 -52
- data/spec/html/proofer/fixtures/vcr_cassettes/links/file_foo_ext_foo_.yml +0 -96
- data/spec/html/proofer/fixtures/vcr_cassettes/links/githubHash_html.yml +0 -73
- data/spec/html/proofer/fixtures/vcr_cassettes/links/linkWithHttps_html.yml +0 -73
- data/spec/html/proofer/fixtures/vcr_cassettes/links/linkWithRedirect_html.yml +0 -236
- data/spec/html/proofer/fixtures/vcr_cassettes/links/linkWithRedirect_html_only_4xx_true_typhoeus_followlocation_false_.yml +0 -318
- data/spec/html/proofer/fixtures/vcr_cassettes/links/linkWithRedirect_html_typhoeus_followlocation_false_.yml +0 -318
- data/spec/html/proofer/fixtures/vcr_cassettes/links/link_missing_protocol_invalid_html.yml +0 -45
- data/spec/html/proofer/fixtures/vcr_cassettes/links/link_missing_protocol_valid_html.yml +0 -73
- data/spec/html/proofer/fixtures/vcr_cassettes/links/nodupe_html.yml +0 -182
- data/spec/html/proofer/fixtures/vcr_cassettes/links/non_standard_characters_html.yml +0 -113
- data/spec/html/proofer/fixtures/vcr_cassettes/links/redirected_error_html.yml +0 -1044
- data/spec/html/proofer/fixtures/vcr_cassettes/links/utf8Link_html.yml +0 -113
- data/spec/html/proofer/fixtures/vcr_cassettes/scripts/script_broken_external_html.yml +0 -45
- data/spec/html/proofer/fixtures/vcr_cassettes/sorting/status_typhoeus_followlocation_false_error_sort_status_.yml +0 -244
- data/spec/html/proofer/fixtures/vcr_cassettes/sorting/status_verbosity_info_typhoeus_followlocation_false_error_sort_status_.yml +0 -244
- data/spec/html/proofer/fixtures/vcr_cassettes/www_garbalarba_com_href_swap_/garbalarba/_github_.yml +0 -73
- data/spec/html/proofer/fixtures/vcr_cassettes/www_github_com_foofoofoo_biz.yml +0 -115
- data/spec/html/proofer/html_spec.rb +0 -64
- data/spec/html/proofer/images_spec.rb +0 -147
- data/spec/html/proofer/links_spec.rb +0 -376
- data/spec/html/proofer/scripts_spec.rb +0 -46
- data/spec/html/proofer/utils_spec.rb +0 -14
- data/spec/html/proofer_spec.rb +0 -122
- data/spec/spec_helper.rb +0 -75
data/spec/html/proofer/fixtures/vcr_cassettes/www_garbalarba_com_href_swap_/garbalarba/_github_.yml
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: head
|
5
|
-
uri: www.github.com
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Mozilla/5.0 (compatible; HTML Proofer/2.3.0; +https://github.com/gjtorikian/html-proofer)
|
12
|
-
response:
|
13
|
-
status:
|
14
|
-
code: 200
|
15
|
-
message: OK
|
16
|
-
headers:
|
17
|
-
Server:
|
18
|
-
- GitHub.com
|
19
|
-
Date:
|
20
|
-
- Mon, 06 Jul 2015 05:10:25 GMT
|
21
|
-
Content-Type:
|
22
|
-
- text/html; charset=utf-8
|
23
|
-
Status:
|
24
|
-
- 200 OK
|
25
|
-
Content-Security-Policy:
|
26
|
-
- 'default-src *; script-src assets-cdn.github.com collector-cdn.github.com;
|
27
|
-
object-src assets-cdn.github.com; style-src ''self'' ''unsafe-inline'' ''unsafe-eval''
|
28
|
-
assets-cdn.github.com; img-src ''self'' data: assets-cdn.github.com identicons.github.com
|
29
|
-
www.google-analytics.com collector.githubapp.com *.githubusercontent.com *.gravatar.com
|
30
|
-
*.wp.com; media-src ''none''; frame-src ''self'' render.githubusercontent.com
|
31
|
-
gist.github.com www.youtube.com player.vimeo.com checkout.paypal.com; font-src
|
32
|
-
assets-cdn.github.com; connect-src ''self'' live.github.com wss://live.github.com
|
33
|
-
uploads.github.com status.github.com api.github.com www.google-analytics.com
|
34
|
-
github-cloud.s3.amazonaws.com'
|
35
|
-
Public-Key-Pins:
|
36
|
-
- max-age=300; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="JbQbUG5JMJUoI6brnx0x3vZF6jilxsapbXGVfjhN8Fg=";
|
37
|
-
includeSubDomains
|
38
|
-
Cache-Control:
|
39
|
-
- no-cache
|
40
|
-
Vary:
|
41
|
-
- X-PJAX
|
42
|
-
- Accept-Encoding
|
43
|
-
X-UA-Compatible:
|
44
|
-
- IE=Edge,chrome=1
|
45
|
-
Set-Cookie:
|
46
|
-
- logged_in=no; domain=.github.com; path=/; expires=Fri, 06 Jul 2035 05:10:25
|
47
|
-
-0000; secure; HttpOnly
|
48
|
-
- _gh_sess=eyJzZXNzaW9uX2lkIjoiNzA3ZmQzMmVhNGE1NDQ4YzUxOGFkMjZkMjk4YThiMjkiLCJfY3NyZl90b2tlbiI6IklTYjRZRUh5dWhra3M3SXRKU0RMVVNTTzYwOXc0MEhSQS85bnJmWCtwT2M9In0%3D--598600b6d119d1c5da32745e013cf915e81b53bf;
|
49
|
-
path=/; secure; HttpOnly
|
50
|
-
X-Request-Id:
|
51
|
-
- 223cae55bc9682cb3b30c3a559c5d2aa
|
52
|
-
X-Runtime:
|
53
|
-
- '0.009497'
|
54
|
-
X-GitHub-Request-Id:
|
55
|
-
- 490F8465:506F:2609878:559A0DC0
|
56
|
-
Strict-Transport-Security:
|
57
|
-
- max-age=31536000; includeSubdomains; preload
|
58
|
-
X-Content-Type-Options:
|
59
|
-
- nosniff
|
60
|
-
X-XSS-Protection:
|
61
|
-
- 1; mode=block
|
62
|
-
X-Frame-Options:
|
63
|
-
- deny
|
64
|
-
X-Served-By:
|
65
|
-
- a0387c52951b3c2853740ef9cede1dec
|
66
|
-
body:
|
67
|
-
encoding: UTF-8
|
68
|
-
string: ''
|
69
|
-
http_version: '1.1'
|
70
|
-
adapter_metadata:
|
71
|
-
effective_url: https://github.com/
|
72
|
-
recorded_at: Mon, 06 Jul 2015 05:10:25 GMT
|
73
|
-
recorded_with: VCR 2.9.3
|
@@ -1,115 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: head
|
5
|
-
uri: foofoofoo.biz
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Mozilla/5.0 (compatible; HTML Proofer/2.3.0; +https://github.com/gjtorikian/html-proofer)
|
12
|
-
response:
|
13
|
-
status:
|
14
|
-
code: 0
|
15
|
-
message:
|
16
|
-
headers: {}
|
17
|
-
body:
|
18
|
-
encoding: UTF-8
|
19
|
-
string: ''
|
20
|
-
http_version:
|
21
|
-
adapter_metadata:
|
22
|
-
effective_url: HTTP://foofoofoo.biz/
|
23
|
-
recorded_at: Mon, 06 Jul 2015 05:10:19 GMT
|
24
|
-
- request:
|
25
|
-
method: get
|
26
|
-
uri: foofoofoo.biz
|
27
|
-
body:
|
28
|
-
encoding: US-ASCII
|
29
|
-
string: ''
|
30
|
-
headers:
|
31
|
-
User-Agent:
|
32
|
-
- Mozilla/5.0 (compatible; HTML Proofer/2.3.0; +https://github.com/gjtorikian/html-proofer)
|
33
|
-
response:
|
34
|
-
status:
|
35
|
-
code: 0
|
36
|
-
message:
|
37
|
-
headers: {}
|
38
|
-
body:
|
39
|
-
encoding: UTF-8
|
40
|
-
string: ''
|
41
|
-
http_version:
|
42
|
-
adapter_metadata:
|
43
|
-
effective_url: HTTP://foofoofoo.biz/
|
44
|
-
recorded_at: Mon, 06 Jul 2015 05:10:19 GMT
|
45
|
-
- request:
|
46
|
-
method: head
|
47
|
-
uri: www.github.com
|
48
|
-
body:
|
49
|
-
encoding: US-ASCII
|
50
|
-
string: ''
|
51
|
-
headers:
|
52
|
-
User-Agent:
|
53
|
-
- Mozilla/5.0 (compatible; HTML Proofer/2.3.0; +https://github.com/gjtorikian/html-proofer)
|
54
|
-
response:
|
55
|
-
status:
|
56
|
-
code: 200
|
57
|
-
message: OK
|
58
|
-
headers:
|
59
|
-
Server:
|
60
|
-
- GitHub.com
|
61
|
-
Date:
|
62
|
-
- Mon, 06 Jul 2015 05:10:21 GMT
|
63
|
-
Content-Type:
|
64
|
-
- text/html; charset=utf-8
|
65
|
-
Status:
|
66
|
-
- 200 OK
|
67
|
-
Content-Security-Policy:
|
68
|
-
- 'default-src *; script-src assets-cdn.github.com collector-cdn.github.com;
|
69
|
-
object-src assets-cdn.github.com; style-src ''self'' ''unsafe-inline'' ''unsafe-eval''
|
70
|
-
assets-cdn.github.com; img-src ''self'' data: assets-cdn.github.com identicons.github.com
|
71
|
-
www.google-analytics.com collector.githubapp.com *.githubusercontent.com *.gravatar.com
|
72
|
-
*.wp.com; media-src ''none''; frame-src ''self'' render.githubusercontent.com
|
73
|
-
gist.github.com www.youtube.com player.vimeo.com checkout.paypal.com; font-src
|
74
|
-
assets-cdn.github.com; connect-src ''self'' live.github.com wss://live.github.com
|
75
|
-
uploads.github.com status.github.com api.github.com www.google-analytics.com
|
76
|
-
github-cloud.s3.amazonaws.com'
|
77
|
-
Public-Key-Pins:
|
78
|
-
- max-age=300; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="JbQbUG5JMJUoI6brnx0x3vZF6jilxsapbXGVfjhN8Fg=";
|
79
|
-
includeSubDomains
|
80
|
-
Cache-Control:
|
81
|
-
- no-cache
|
82
|
-
Vary:
|
83
|
-
- X-PJAX
|
84
|
-
- Accept-Encoding
|
85
|
-
X-UA-Compatible:
|
86
|
-
- IE=Edge,chrome=1
|
87
|
-
Set-Cookie:
|
88
|
-
- logged_in=no; domain=.github.com; path=/; expires=Fri, 06 Jul 2035 05:10:21
|
89
|
-
-0000; secure; HttpOnly
|
90
|
-
- _gh_sess=eyJzZXNzaW9uX2lkIjoiYjVmM2Q3ZjFhODQxMWIxNjdhODIyNWQ5ZGI1ZDNlMDkiLCJfY3NyZl90b2tlbiI6IlE5R1lsT3pFWW9Fb2VJWndZVGJUQ1ZodzJCeXZsclBzYmVEc1JvdVU1VE09In0%3D--afddd987025ba23ca6db5388811d74e15126663a;
|
91
|
-
path=/; secure; HttpOnly
|
92
|
-
X-Request-Id:
|
93
|
-
- cfa6252fd906896bc99fa744471f06af
|
94
|
-
X-Runtime:
|
95
|
-
- '0.009622'
|
96
|
-
X-GitHub-Request-Id:
|
97
|
-
- 490F8465:506E:3EED418:559A0DBD
|
98
|
-
Strict-Transport-Security:
|
99
|
-
- max-age=31536000; includeSubdomains; preload
|
100
|
-
X-Content-Type-Options:
|
101
|
-
- nosniff
|
102
|
-
X-XSS-Protection:
|
103
|
-
- 1; mode=block
|
104
|
-
X-Frame-Options:
|
105
|
-
- deny
|
106
|
-
X-Served-By:
|
107
|
-
- a22dbcbd09a98eacdd14ac7804a635dd
|
108
|
-
body:
|
109
|
-
encoding: UTF-8
|
110
|
-
string: ''
|
111
|
-
http_version: '1.1'
|
112
|
-
adapter_metadata:
|
113
|
-
effective_url: https://github.com/
|
114
|
-
recorded_at: Mon, 06 Jul 2015 05:10:21 GMT
|
115
|
-
recorded_with: VCR 2.9.3
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Html test' do
|
4
|
-
it 'ignores an invalid tag by default' do
|
5
|
-
html = "#{FIXTURES_DIR}/html/invalid_tag.html"
|
6
|
-
proofer = run_proofer(html)
|
7
|
-
expect(proofer.failed_tests).to eq []
|
8
|
-
end
|
9
|
-
|
10
|
-
it "doesn't fail for html5 tags" do
|
11
|
-
html = "#{FIXTURES_DIR}/html/html5_tags.html"
|
12
|
-
proofer = run_proofer(html, { :check_html => true })
|
13
|
-
expect(proofer.failed_tests).to eq []
|
14
|
-
end
|
15
|
-
|
16
|
-
it "doesn't fail for svg elements" do
|
17
|
-
html = "#{FIXTURES_DIR}/html/svg_elements.html"
|
18
|
-
proofer = run_proofer(html, { :check_html => true })
|
19
|
-
expect(proofer.failed_tests).to eq []
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'fails for an invalid tag' do
|
23
|
-
html = "#{FIXTURES_DIR}/html/invalid_tag.html"
|
24
|
-
proofer = run_proofer(html, { :check_html => true })
|
25
|
-
expect(proofer.failed_tests.first).to match(/Tag myfancytag invalid \(line 2\)/)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'fails for an unmatched end tag' do
|
29
|
-
html = "#{FIXTURES_DIR}/html/unmatched_end_tag.html"
|
30
|
-
proofer = run_proofer(html, { :check_html => true })
|
31
|
-
expect(proofer.failed_tests.first).to match(/Unexpected end tag : div \(line 3\)/)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'fails for an unescaped ampersand in attribute' do
|
35
|
-
html = "#{FIXTURES_DIR}/html/unescaped_ampersand_in_attribute.html"
|
36
|
-
proofer = run_proofer(html, { :check_html => true })
|
37
|
-
expect(proofer.failed_tests.first).to match(/htmlParseEntityRef: expecting ';' \(line 2\)/)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'fails for mismatch between opening and ending tag' do
|
41
|
-
html = "#{FIXTURES_DIR}/html/opening_and_ending_tag_mismatch.html"
|
42
|
-
proofer = run_proofer(html, { :check_html => true })
|
43
|
-
expect(proofer.failed_tests.first).to match(/Opening and ending tag mismatch: p and strong/)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'fails for div inside head' do
|
47
|
-
html = "#{FIXTURES_DIR}/html/div_inside_head.html"
|
48
|
-
proofer = run_proofer(html, { :check_html => true })
|
49
|
-
expect(proofer.failed_tests.first).to match(/Unexpected end tag : head \(line 5\)/)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'fails for missing closing quotation mark in href' do
|
53
|
-
html = "#{FIXTURES_DIR}/html/missing_closing_quotes.html"
|
54
|
-
proofer = run_proofer(html, { :check_html => true })
|
55
|
-
expect(proofer.failed_tests.to_s).to match(/Couldn't find end of Start Tag a \(line 6\)/)
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'ignores embeded scripts when asked' do
|
59
|
-
opts = { :check_html => true, :validation => { :ignore_script_embeds => true } }
|
60
|
-
ignorableScript = "#{FIXTURES_DIR}/html/ignore_script_embeds.html"
|
61
|
-
proofer = run_proofer(ignorableScript, opts)
|
62
|
-
expect(proofer.failed_tests).to eq []
|
63
|
-
end
|
64
|
-
end
|
@@ -1,147 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Images test' do
|
4
|
-
it 'passes for existing external images' do
|
5
|
-
externalImageFilepath = "#{FIXTURES_DIR}/images/existingImageExternal.html"
|
6
|
-
proofer = run_proofer(externalImageFilepath)
|
7
|
-
expect(proofer.failed_tests).to eq []
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'fails for image without alt attribute' do
|
11
|
-
missingAltFilepath = "#{FIXTURES_DIR}/images/missingImageAlt.html"
|
12
|
-
proofer = run_proofer(missingAltFilepath)
|
13
|
-
expect(proofer.failed_tests.first).to match(/gpl.png does not have an alt attribute/)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'fails for image with an empty alt attribute' do
|
17
|
-
missingAltFilepath = "#{FIXTURES_DIR}/images/missingImageAltText.html"
|
18
|
-
proofer = run_proofer(missingAltFilepath)
|
19
|
-
expect(proofer.failed_tests.first).to match(/gpl.png does not have an alt attribute/)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'fails for image with nothing but spaces in alt attribute' do
|
23
|
-
emptyAltFilepath = "#{FIXTURES_DIR}/images/emptyImageAltText.html"
|
24
|
-
proofer = run_proofer(emptyAltFilepath)
|
25
|
-
expect(proofer.failed_tests.first).to match(/gpl.png does not have an alt attribute/)
|
26
|
-
expect(proofer.failed_tests.length).to equal(3)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'passes when ignoring image with nothing but spaces in alt attribute' do
|
30
|
-
emptyAltFilepath = "#{FIXTURES_DIR}/images/emptyImageAltText.html"
|
31
|
-
proofer = run_proofer(emptyAltFilepath, {:alt_ignore => [/.+/]})
|
32
|
-
expect(proofer.failed_tests).to eq []
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'fails for missing external images' do
|
36
|
-
externalImageFilepath = "#{FIXTURES_DIR}/images/missingImageExternal.html"
|
37
|
-
proofer = run_proofer(externalImageFilepath)
|
38
|
-
expect(proofer.failed_tests.first).to match(/failed: 0/)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'fails for missing internal images' do
|
42
|
-
internalImageFilepath = "#{FIXTURES_DIR}/images/missingImageInternal.html"
|
43
|
-
proofer = run_proofer(internalImageFilepath)
|
44
|
-
expect(proofer.failed_tests.first).to match(/doesnotexist.png does not exist/)
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'fails for image with no src' do
|
48
|
-
imageSrcFilepath = "#{FIXTURES_DIR}/images/missingImageSrc.html"
|
49
|
-
proofer = run_proofer(imageSrcFilepath)
|
50
|
-
expect(proofer.failed_tests.first).to match(/image has no src or srcset attribute/)
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'fails for image with default mac filename' do
|
54
|
-
terribleImageName = "#{FIXTURES_DIR}/images/terribleImageName.html"
|
55
|
-
proofer = run_proofer(terribleImageName)
|
56
|
-
expect(proofer.failed_tests.first).to match(/image has a terrible filename/)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'ignores images marked as ignore data-proofer-ignore' do
|
60
|
-
ignorableImages = "#{FIXTURES_DIR}/images/ignorableImages.html"
|
61
|
-
proofer = run_proofer(ignorableImages)
|
62
|
-
expect(proofer.failed_tests).to eq []
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'properly checks relative images' do
|
66
|
-
relativeImages = "#{FIXTURES_DIR}/images/rootRelativeImages.html"
|
67
|
-
proofer = run_proofer(relativeImages)
|
68
|
-
expect(proofer.failed_tests).to eq []
|
69
|
-
|
70
|
-
relativeImages = "#{FIXTURES_DIR}/resources/books/nestedRelativeImages.html"
|
71
|
-
proofer = run_proofer(relativeImages)
|
72
|
-
expect(proofer.failed_tests).to eq []
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'properly ignores data URI images' do
|
76
|
-
dataURIImage = "#{FIXTURES_DIR}/images/workingDataURIImage.html"
|
77
|
-
proofer = run_proofer(dataURIImage)
|
78
|
-
expect(proofer.failed_tests).to eq []
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'works for valid images missing the protocol' do
|
82
|
-
missingProtocolLink = "#{FIXTURES_DIR}/images/image_missing_protocol_valid.html"
|
83
|
-
proofer = run_proofer(missingProtocolLink)
|
84
|
-
expect(proofer.failed_tests).to eq []
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'fails for invalid images missing the protocol' do
|
88
|
-
missingProtocolLink = "#{FIXTURES_DIR}/images/image_missing_protocol_invalid.html"
|
89
|
-
proofer = run_proofer(missingProtocolLink)
|
90
|
-
expect(proofer.failed_tests.first).to match(/failed: 404/)
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'properly checks relative links' do
|
94
|
-
relativeLinks = "#{FIXTURES_DIR}/images/relativeToSelf.html"
|
95
|
-
proofer = run_proofer(relativeLinks)
|
96
|
-
expect(proofer.failed_tests).to eq []
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'properly ignores missing alt tags when asked' do
|
100
|
-
ignorableLinks = "#{FIXTURES_DIR}/images/ignorableAltViaOptions.html"
|
101
|
-
proofer = run_proofer(ignorableLinks, {:alt_ignore => [/wikimedia/, "gpl.png"]})
|
102
|
-
expect(proofer.failed_tests).to eq []
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'properly ignores missing alt tags, but not all URLs, when asked' do
|
106
|
-
ignorableLinks = "#{FIXTURES_DIR}/images/ignoreAltButNotLink.html"
|
107
|
-
proofer = run_proofer(ignorableLinks, {:alt_ignore => [/.*/]})
|
108
|
-
expect(proofer.failed_tests.first).to match(/failed: 0/)
|
109
|
-
expect(proofer.failed_tests.first).to_not match /does not have an alt attribute/
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'properly ignores empty alt attribute when empty_alt_ignore set' do
|
113
|
-
missingAltFilepath = "#{FIXTURES_DIR}/images/emptyImageAltText.html"
|
114
|
-
proofer = run_proofer(missingAltFilepath, {:empty_alt_ignore => true})
|
115
|
-
expect(proofer.failed_tests).to eq []
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'properly ignores empty alt attributes, but not missing alt attributes, when empty_alt_ignore set' do
|
119
|
-
missingAltFilepath = "#{FIXTURES_DIR}/images/missingImageAlt.html"
|
120
|
-
proofer = run_proofer(missingAltFilepath, {:empty_alt_ignore => true})
|
121
|
-
expect(proofer.failed_tests.first).to match(/gpl.png does not have an alt attribute/)
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'works for images with a srcset' do
|
125
|
-
srcSetCheck = "#{FIXTURES_DIR}/images/srcSetCheck.html"
|
126
|
-
proofer = run_proofer(srcSetCheck)
|
127
|
-
expect(proofer.failed_tests).to eq []
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'fails for images with a srcset but missing alt' do
|
131
|
-
srcSetMissingAlt = "#{FIXTURES_DIR}/images/srcSetMissingAlt.html"
|
132
|
-
proofer = run_proofer(srcSetMissingAlt)
|
133
|
-
expect(proofer.failed_tests.first).to match(/image gpl.png does not have an alt attribute/)
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'fails for images with an alt but missing src or srcset' do
|
137
|
-
srcSetMissingAlt = "#{FIXTURES_DIR}/images/srcSetMissingImage.html"
|
138
|
-
proofer = run_proofer(srcSetMissingAlt)
|
139
|
-
expect(proofer.failed_tests.first).to match(/internal image notreal.png does not exist/)
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'properly ignores missing alt tags when asked for srcset' do
|
143
|
-
ignorableLinks = "#{FIXTURES_DIR}/images/srcSetIgnorable.html"
|
144
|
-
proofer = run_proofer(ignorableLinks, {:alt_ignore => [/wikimedia/, "gpl.png"]})
|
145
|
-
expect(proofer.failed_tests).to eq []
|
146
|
-
end
|
147
|
-
end
|
@@ -1,376 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Links test' do
|
4
|
-
|
5
|
-
it 'fails for broken internal hash (even if the file exists)' do
|
6
|
-
brokenHashExternalFilepath = "#{FIXTURES_DIR}/links/brokenHashExternal.html"
|
7
|
-
proofer = run_proofer(brokenHashExternalFilepath)
|
8
|
-
expect(proofer.failed_tests.last).to match(%r{linking to ../images/missingImageAlt.html#asdfasfdkafl, but asdfasfdkafl does not exist})
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'fails for broken hashes on the web when asked (even if the file exists)' do
|
12
|
-
brokenHashOnTheWeb = "#{FIXTURES_DIR}/links/brokenHashOnTheWeb.html"
|
13
|
-
proofer = run_proofer(brokenHashOnTheWeb, { :check_external_hash => true} )
|
14
|
-
expect(proofer.failed_tests.first).to match(/but the hash 'no' does not/)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'passes for broken hashes on the web when ignored (even if the file exists)' do
|
18
|
-
brokenHashOnTheWeb = "#{FIXTURES_DIR}/links/brokenHashOnTheWeb.html"
|
19
|
-
proofer = run_proofer(brokenHashOnTheWeb)
|
20
|
-
expect(proofer.failed_tests).to eq []
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'passes for GitHub hashes on the web when asked' do
|
24
|
-
githubHash = "#{FIXTURES_DIR}/links/githubHash.html"
|
25
|
-
proofer = run_proofer(githubHash)
|
26
|
-
expect(proofer.failed_tests).to eq []
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'passes for broken hashes on the web (when we look only for 4xx)' do
|
30
|
-
options = { :only_4xx => true }
|
31
|
-
brokenHashOnTheWeb = "#{FIXTURES_DIR}/links/brokenHashOnTheWeb.html"
|
32
|
-
proofer = run_proofer(brokenHashOnTheWeb, options)
|
33
|
-
expect(proofer.failed_tests).to eq []
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'fails for broken internal hash' do
|
37
|
-
brokenHashInternalFilepath = "#{FIXTURES_DIR}/links/brokenHashInternal.html"
|
38
|
-
proofer = run_proofer(brokenHashInternalFilepath)
|
39
|
-
expect(proofer.failed_tests.first).to match(/linking to internal hash #noHash that does not exist/)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'fails for broken external links' do
|
43
|
-
brokenLinkExternalFilepath = "#{FIXTURES_DIR}/links/brokenLinkExternal.html"
|
44
|
-
proofer = run_proofer(brokenLinkExternalFilepath)
|
45
|
-
expect(proofer.failed_tests.first).to match(/failed: 0/)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'passes for different filename without option' do
|
49
|
-
brokenLinkExternalFilepath = "#{FIXTURES_DIR}/links/file.foo"
|
50
|
-
proofer = run_proofer(brokenLinkExternalFilepath)
|
51
|
-
expect(proofer.failed_tests).to eq []
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'fails for different filenames' do
|
55
|
-
options = { :ext => '.foo' }
|
56
|
-
brokenLinkExternalFilepath = "#{FIXTURES_DIR}/links/file.foo"
|
57
|
-
proofer = run_proofer(brokenLinkExternalFilepath, options)
|
58
|
-
expect(proofer.failed_tests.first).to match(/failed: 0/)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'fails for broken internal links' do
|
62
|
-
brokenLinkInternalFilepath = "#{FIXTURES_DIR}/links/brokenLinkInternal.html"
|
63
|
-
proofer = run_proofer(brokenLinkInternalFilepath)
|
64
|
-
expect(proofer.failed_tests.first).to match(/internally linking to .\/notreal.html, which does not exist/)
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'fails for link with no href' do
|
68
|
-
missingLinkHrefFilepath = "#{FIXTURES_DIR}/links/missingLinkHref.html"
|
69
|
-
proofer = run_proofer(missingLinkHrefFilepath)
|
70
|
-
expect(proofer.failed_tests.first).to match(/anchor has no href attribute/)
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'should follow redirects' do
|
74
|
-
linkWithRedirectFilepath = "#{FIXTURES_DIR}/links/linkWithRedirect.html"
|
75
|
-
proofer = run_proofer(linkWithRedirectFilepath)
|
76
|
-
expect(proofer.failed_tests).to eq []
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'fails on redirects if not following' do
|
80
|
-
linkWithRedirectFilepath = "#{FIXTURES_DIR}/links/linkWithRedirect.html"
|
81
|
-
proofer = run_proofer(linkWithRedirectFilepath, :typhoeus => { :followlocation => false })
|
82
|
-
expect(proofer.failed_tests.first).to match(/failed: 301/)
|
83
|
-
end
|
84
|
-
|
85
|
-
it "does not fail on redirects we're not following" do
|
86
|
-
# this test should emit a 301--see above--but we're intentionally supressing it
|
87
|
-
linkWithRedirectFilepath = "#{FIXTURES_DIR}/links/linkWithRedirect.html"
|
88
|
-
proofer = run_proofer(linkWithRedirectFilepath, { :only_4xx => true, :typhoeus => { :followlocation => false } })
|
89
|
-
expect(proofer.failed_tests).to eq []
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'should understand https' do
|
93
|
-
linkWithHttpsFilepath = "#{FIXTURES_DIR}/links/linkWithHttps.html"
|
94
|
-
proofer = run_proofer(linkWithHttpsFilepath)
|
95
|
-
expect(proofer.failed_tests).to eq []
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'fails for broken hash links with status code numbers' do
|
99
|
-
brokenLinkWithNumberFilepath = "#{FIXTURES_DIR}/links/brokenLinkWithNumber.html"
|
100
|
-
proofer = run_proofer(brokenLinkWithNumberFilepath)
|
101
|
-
expect(proofer.failed_tests.first).to match(/linking to internal hash #25-method-not-allowed that does not exist/)
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'properly resolves implicit /index.html in link paths' do
|
105
|
-
linkToFolder = "#{FIXTURES_DIR}/links/linkToFolder.html"
|
106
|
-
proofer = run_proofer(linkToFolder)
|
107
|
-
expect(proofer.failed_tests).to eq []
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'properly checks links to root' do
|
111
|
-
rootLink = "#{FIXTURES_DIR}/links/rootLink/rootLink.html"
|
112
|
-
proofer = run_proofer(rootLink)
|
113
|
-
expect(proofer.failed_tests).to eq []
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'properly checks relative links' do
|
117
|
-
relativeLinks = "#{FIXTURES_DIR}/links/relativeLinks.html"
|
118
|
-
proofer = run_proofer(relativeLinks)
|
119
|
-
expect(proofer.failed_tests).to eq []
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'properly checks ssl links' do
|
123
|
-
checkSSLLinks = "#{FIXTURES_DIR}/links/checkSSLLinks.html"
|
124
|
-
proofer = run_proofer(checkSSLLinks)
|
125
|
-
expect(proofer.failed_tests).to eq []
|
126
|
-
end
|
127
|
-
|
128
|
-
it 'ignores links marked as ignore data-proofer-ignore' do
|
129
|
-
ignorableLinks = "#{FIXTURES_DIR}/links/ignorableLinks.html"
|
130
|
-
proofer = run_proofer(ignorableLinks)
|
131
|
-
expect(proofer.failed_tests).to eq []
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'ignores links via href_ignore' do
|
135
|
-
ignorableLinks = "#{FIXTURES_DIR}/links/ignorableLinksViaOptions.html"
|
136
|
-
proofer = run_proofer(ignorableLinks, { :href_ignore => [%r{^http://}, /sdadsad/, '../whaadadt.html'] })
|
137
|
-
expect(proofer.failed_tests).to eq []
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'translates links via href_swap' do
|
141
|
-
translatedLink = "#{FIXTURES_DIR}/links/linkTranslatedViaHrefSwap.html"
|
142
|
-
proofer = run_proofer(translatedLink, { :href_swap => { %r{\A/articles/([\w-]+)} => "\\1.html" } })
|
143
|
-
expect(proofer.failed_tests).to eq []
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'translates links via href_swap for list of links' do
|
147
|
-
proofer = run_proofer(['www.garbalarba.com'], { :href_swap => { /garbalarba/ => 'github' } })
|
148
|
-
expect(proofer.failed_tests).to eq []
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'finds a mix of broken and unbroken links' do
|
152
|
-
multipleProblems = "#{FIXTURES_DIR}/links/multipleProblems.html"
|
153
|
-
proofer = run_proofer(multipleProblems)
|
154
|
-
expect(proofer.failed_tests.first).to match(/linking to internal hash #anadaasdadsadschor that does not exist/)
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'ignores valid mailto links' do
|
158
|
-
ignorableLinks = "#{FIXTURES_DIR}/links/mailto_link.html"
|
159
|
-
proofer = run_proofer(ignorableLinks)
|
160
|
-
expect(proofer.failed_tests).to eq []
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'fails for blank mailto links' do
|
164
|
-
blankMailToLink = "#{FIXTURES_DIR}/links/blank_mailto_link.html"
|
165
|
-
proofer = run_proofer(blankMailToLink)
|
166
|
-
expect(proofer.failed_tests.first).to match(/mailto: contains no email address/)
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'fails for invalid mailto links' do
|
170
|
-
invalidMailToLink = "#{FIXTURES_DIR}/links/invalid_mailto_link.html"
|
171
|
-
proofer = run_proofer(invalidMailToLink)
|
172
|
-
expect(proofer.failed_tests.first).to match(/mailto:octocat contains an invalid email address/)
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'ignores valid tel links' do
|
176
|
-
ignorableLinks = "#{FIXTURES_DIR}/links/tel_link.html"
|
177
|
-
proofer = run_proofer(ignorableLinks)
|
178
|
-
expect(proofer.failed_tests).to eq []
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'fails for blank tel links' do
|
182
|
-
blankTelLink = "#{FIXTURES_DIR}/links/blank_tel_link.html"
|
183
|
-
proofer = run_proofer(blankTelLink)
|
184
|
-
expect(proofer.failed_tests.first).to match(/tel: contains no phone number/)
|
185
|
-
end
|
186
|
-
|
187
|
-
it 'ignores javascript links' do
|
188
|
-
javascriptLink = "#{FIXTURES_DIR}/links/javascript_link.html"
|
189
|
-
proofer = run_proofer(javascriptLink)
|
190
|
-
expect(proofer.failed_tests).to eq []
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'works for valid links missing the protocol' do
|
194
|
-
missingProtocolLink = "#{FIXTURES_DIR}/links/link_missing_protocol_valid.html"
|
195
|
-
proofer = run_proofer(missingProtocolLink)
|
196
|
-
expect(proofer.failed_tests).to eq []
|
197
|
-
end
|
198
|
-
|
199
|
-
it 'fails for invalid links missing the protocol' do
|
200
|
-
missingProtocolLink = "#{FIXTURES_DIR}/links/link_missing_protocol_invalid.html"
|
201
|
-
proofer = run_proofer(missingProtocolLink)
|
202
|
-
expect(proofer.failed_tests.first).to match(/failed: 0/)
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'works for valid href within link elements' do
|
206
|
-
head_link = "#{FIXTURES_DIR}/links/head_link_href.html"
|
207
|
-
proofer = run_proofer(head_link)
|
208
|
-
expect(proofer.failed_tests).to eq []
|
209
|
-
end
|
210
|
-
|
211
|
-
it 'fails for empty href within link elements' do
|
212
|
-
head_link = "#{FIXTURES_DIR}/links/head_link_href_empty.html"
|
213
|
-
proofer = run_proofer(head_link)
|
214
|
-
expect(proofer.failed_tests.first).to match(/anchor has no href attribute/)
|
215
|
-
end
|
216
|
-
|
217
|
-
it 'fails for absent href within link elements' do
|
218
|
-
head_link = "#{FIXTURES_DIR}/links/head_link_href_absent.html"
|
219
|
-
proofer = run_proofer(head_link)
|
220
|
-
expect(proofer.failed_tests.first).to match(/anchor has no href attribute/)
|
221
|
-
end
|
222
|
-
|
223
|
-
it 'fails for internal linking to a directory without trailing slash' do
|
224
|
-
options = { :typhoeus => { :followlocation => false } }
|
225
|
-
internal = "#{FIXTURES_DIR}/links/link_directory_without_slash.html"
|
226
|
-
proofer = run_proofer(internal, options)
|
227
|
-
expect(proofer.failed_tests.first).to match(/without trailing slash/)
|
228
|
-
end
|
229
|
-
|
230
|
-
it 'ignores external links when asked' do
|
231
|
-
options = { :disable_external => true }
|
232
|
-
external = "#{FIXTURES_DIR}/links/brokenLinkExternal.html"
|
233
|
-
proofer = run_proofer(external, options)
|
234
|
-
expect(proofer.failed_tests).to eq []
|
235
|
-
end
|
236
|
-
|
237
|
-
it 'works for array of links' do
|
238
|
-
proofer = run_proofer(['www.github.com', 'foofoofoo.biz'])
|
239
|
-
expect(proofer.failed_tests.first).to match(/failed: 0/)
|
240
|
-
end
|
241
|
-
|
242
|
-
it 'works for broken anchors within pre' do
|
243
|
-
anchor_pre = "#{FIXTURES_DIR}/links/anchors_in_pre.html"
|
244
|
-
proofer = run_proofer(anchor_pre)
|
245
|
-
expect(proofer.failed_tests).to eq []
|
246
|
-
end
|
247
|
-
|
248
|
-
it 'works for broken link within pre' do
|
249
|
-
link_pre = "#{FIXTURES_DIR}/links/links_in_pre.html"
|
250
|
-
proofer = run_proofer(link_pre)
|
251
|
-
expect(proofer.failed_tests).to eq []
|
252
|
-
end
|
253
|
-
|
254
|
-
it 'works for pipes in the URL' do
|
255
|
-
escape_pipes = "#{FIXTURES_DIR}/links/escape_pipes.html"
|
256
|
-
proofer = run_proofer(escape_pipes)
|
257
|
-
expect(proofer.failed_tests).to eq []
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'fails for broken hash with query' do
|
261
|
-
broken_hash = "#{FIXTURES_DIR}/links/broken_hash_with_query.html"
|
262
|
-
proofer = run_proofer(broken_hash)
|
263
|
-
expect(proofer.failed_tests.first).to match(/linking to internal hash #example that does not exist/)
|
264
|
-
end
|
265
|
-
|
266
|
-
it 'works for directory index file' do
|
267
|
-
options = { :directory_index_file => "index.php" }
|
268
|
-
link_pointing_to_directory = "#{FIXTURES_DIR}/links/link_pointing_to_directory.html"
|
269
|
-
proofer = run_proofer(link_pointing_to_directory, options)
|
270
|
-
expect(proofer.failed_tests).to eq []
|
271
|
-
end
|
272
|
-
|
273
|
-
it "fails if directory index file doesn't exist" do
|
274
|
-
options = { :directory_index_file => "README.md" }
|
275
|
-
link_pointing_to_directory = "#{FIXTURES_DIR}/links/link_pointing_to_directory.html"
|
276
|
-
proofer = run_proofer(link_pointing_to_directory, options)
|
277
|
-
expect(proofer.failed_tests.first).to match "internally linking to folder-php/, which does not exist"
|
278
|
-
end
|
279
|
-
|
280
|
-
it 'ensures Typhoeus options are passed' do
|
281
|
-
options = { :typhoeus => { :ssl_verifypeer => false } }
|
282
|
-
typhoeus_options_link = "#{FIXTURES_DIR}/links/ensure_typhoeus_options.html"
|
283
|
-
proofer = run_proofer(typhoeus_options_link, options)
|
284
|
-
expect(proofer.failed_tests).to eq []
|
285
|
-
end
|
286
|
-
|
287
|
-
it 'works if subdirectory ends with .html' do
|
288
|
-
with_subdirectory_html = "#{FIXTURES_DIR}/links/_site"
|
289
|
-
proofer = run_proofer(with_subdirectory_html)
|
290
|
-
expect(proofer.failed_tests).to eq []
|
291
|
-
end
|
292
|
-
|
293
|
-
it 'works for hash referring to itself' do
|
294
|
-
hashReferringToSelf = "#{FIXTURES_DIR}/links/hashReferringToSelf.html"
|
295
|
-
proofer = run_proofer(hashReferringToSelf)
|
296
|
-
expect(proofer.failed_tests).to eq []
|
297
|
-
end
|
298
|
-
|
299
|
-
it 'ignores placeholder with name' do
|
300
|
-
placeholder_with_name = "#{FIXTURES_DIR}/links/placeholder_with_name.html"
|
301
|
-
proofer = run_proofer(placeholder_with_name)
|
302
|
-
expect(proofer.failed_tests).to eq []
|
303
|
-
end
|
304
|
-
|
305
|
-
it 'ignores placeholder with id' do
|
306
|
-
placeholder_with_id = "#{FIXTURES_DIR}/links/placeholder_with_id.html"
|
307
|
-
proofer = run_proofer(placeholder_with_id)
|
308
|
-
expect(proofer.failed_tests).to eq []
|
309
|
-
end
|
310
|
-
|
311
|
-
it 'fails for placeholder with empty id' do
|
312
|
-
empty_id = "#{FIXTURES_DIR}/links/placeholder_with_empty_id.html"
|
313
|
-
proofer = run_proofer(empty_id)
|
314
|
-
expect(proofer.failed_tests.first).to match(/anchor has no href attribute/)
|
315
|
-
end
|
316
|
-
|
317
|
-
it 'ignores non-http(s) protocols' do
|
318
|
-
other_protocols = "#{FIXTURES_DIR}/links/other_protocols.html"
|
319
|
-
proofer = run_proofer(other_protocols)
|
320
|
-
expect(proofer.failed_tests).to eq []
|
321
|
-
end
|
322
|
-
|
323
|
-
it 'passes non-standard characters' do
|
324
|
-
fixture = "#{FIXTURES_DIR}/links/non_standard_characters.html"
|
325
|
-
proofer = run_proofer(fixture)
|
326
|
-
expect(proofer.failed_tests).to eq []
|
327
|
-
end
|
328
|
-
|
329
|
-
it 'does not dupe errors' do
|
330
|
-
fixture = "#{FIXTURES_DIR}/links/nodupe.html"
|
331
|
-
proofer = run_proofer(fixture)
|
332
|
-
expect(proofer.failed_tests.length).to eq 1
|
333
|
-
end
|
334
|
-
|
335
|
-
it 'passes for broken *nix links' do
|
336
|
-
fixture = "#{FIXTURES_DIR}/links/brokenUnixLinks.html"
|
337
|
-
proofer = run_proofer(fixture)
|
338
|
-
expect(proofer.failed_tests).to eq []
|
339
|
-
end
|
340
|
-
|
341
|
-
it 'passes for external UTF-8 links' do
|
342
|
-
fixture = "#{FIXTURES_DIR}/links/utf8Link.html"
|
343
|
-
proofer = run_proofer(fixture)
|
344
|
-
expect(proofer.failed_tests).to eq []
|
345
|
-
end
|
346
|
-
|
347
|
-
it 'passes for urlencoded href' do
|
348
|
-
fixture = "#{FIXTURES_DIR}/links/urlencoded-href.html"
|
349
|
-
proofer = run_proofer(fixture)
|
350
|
-
expect(proofer.failed_tests).to eq []
|
351
|
-
end
|
352
|
-
|
353
|
-
it 'reports failures for the original link, not the redirection' do
|
354
|
-
fixture = "#{FIXTURES_DIR}/links/redirected_error.html"
|
355
|
-
proofer = run_proofer(fixture)
|
356
|
-
expect(proofer.failed_tests.first).to match(/failed: 404/)
|
357
|
-
end
|
358
|
-
|
359
|
-
it 'does not complain for files with attributes containing dashes' do
|
360
|
-
fixture = "#{FIXTURES_DIR}/links/attributeWithDash.html"
|
361
|
-
proofer = run_proofer(fixture)
|
362
|
-
expect(proofer.failed_tests).to eq []
|
363
|
-
end
|
364
|
-
|
365
|
-
it 'does not complain for internal links with mismatched cases' do
|
366
|
-
fixture = "#{FIXTURES_DIR}/links/ignores_cases.html"
|
367
|
-
proofer = run_proofer(fixture)
|
368
|
-
expect(proofer.failed_tests).to eq []
|
369
|
-
end
|
370
|
-
|
371
|
-
it 'does not check links with parameters multiple times' do
|
372
|
-
fixture = "#{FIXTURES_DIR}/links/check_just_once.html"
|
373
|
-
proofer = run_proofer(fixture)
|
374
|
-
expect(proofer.iterable_external_urls.length).to eq 2
|
375
|
-
end
|
376
|
-
end
|