|
11 | 11 | let(:page_with_many_redirect_to) { setup_page("multiple_redirect_tos.md") } |
12 | 12 |
|
13 | 13 | it "knows if a page or post is requesting a redirect page" do |
14 | | - if Jekyll::VERSION < '3.0.0' |
15 | | - expect(redirector.has_alt_urls?(post_to_redirect)).to be_truthy |
16 | | - else |
| 14 | + if JekyllRedirectFrom.jekyll_3? |
17 | 15 | skip "Don't need to test posts in Jekyll 3" |
| 16 | + else |
| 17 | + expect(redirector.has_alt_urls?(post_to_redirect)).to be_truthy |
18 | 18 | end |
19 | 19 | end |
20 | 20 |
|
|
52 | 52 | end |
53 | 53 |
|
54 | 54 | it "generates the refresh page for the post properly" do |
55 | | - expect(destination_file_exists?("posts/23128432159832/mary-had-a-little-lamb")).to be_truthy |
| 55 | + expect(dest_dir("posts/23128432159832/mary-had-a-little-lamb#{forced_output_ext}")).to exist |
56 | 56 | end |
57 | 57 |
|
58 | 58 | it "generates the refresh pages for the page with multiple redirect_from urls" do |
59 | | - expect(destination_file_exists?("help")).to be_truthy |
60 | | - expect(destination_file_exists?("contact")).to be_truthy |
61 | | - expect(destination_file_exists?("let-there/be/light-he-said")).to be_truthy |
62 | | - expect(destination_file_exists?("/geepers/mccreepin")).to be_truthy |
| 59 | + expect(dest_dir("help")).to be_truthy |
| 60 | + expect(dest_dir("contact")).to be_truthy |
| 61 | + expect(dest_dir("let-there/be/light-he-said")).to be_truthy |
| 62 | + expect(dest_dir("/geepers/mccreepin")).to be_truthy |
63 | 63 | end |
64 | 64 |
|
65 | 65 | it "generates the refresh page for the page with one redirect_from url" do |
66 | | - expect(destination_file_exists?("mencius/was/my/father")).to be_truthy |
| 66 | + expect(dest_dir("mencius/was/my/father#{forced_output_ext}")).to exist |
67 | 67 | end |
68 | 68 |
|
69 | 69 | it "generates the refresh page for the collection with one redirect_to url" do |
70 | | - expect(@dest.join("articles", "redirect-somewhere-else-plz.html")).to exist |
71 | | - expect(destination_doc_contents("articles", "redirect-somewhere-else-plz.html")).to include(%|<meta http-equiv="refresh" content="0; url=http://www.zombo.com">|) |
| 70 | + expect(dest_dir("articles", "redirect-somewhere-else-plz.html")).to exist |
| 71 | + expect(dest_dir("articles", "redirect-somewhere-else-plz.html").read).to include(%|<meta http-equiv="refresh" content="0; url=http://www.zombo.com">|) |
72 | 72 | end |
73 | 73 |
|
74 | 74 | it "generates the refresh page for the page with one redirect_to url" do |
75 | | - expect(destination_file_exists?("one_redirect_to.html")).to be_truthy |
76 | | - expect(destination_file_contents("one_redirect_to.html")).to include(%|<meta http-equiv="refresh" content="0; url=https://www.github.com">|) |
| 75 | + expect(dest_dir("one_redirect_to.html")).to exist |
| 76 | + expect(dest_dir("one_redirect_to.html").read).to include(%|<meta http-equiv="refresh" content="0; url=https://www.github.com">|) |
77 | 77 | end |
78 | 78 |
|
79 | 79 | it "generates the refresh page for the page with multiple redirect_to urls" do |
80 | | - expect(destination_file_exists?("multiple_redirect_tos.html")).to be_truthy |
81 | | - expect(destination_file_contents("multiple_redirect_tos.html")).to include(%|<meta http-equiv="refresh" content="0; url=https://www.jekyllrb.com">|) |
| 80 | + expect(dest_dir("multiple_redirect_tos.html")).to exist |
| 81 | + expect(dest_dir("multiple_redirect_tos.html").read).to include(%|<meta http-equiv="refresh" content="0; url=https://www.jekyllrb.com">|) |
82 | 82 | end |
83 | 83 | end |
84 | 84 |
|
|
0 commit comments