|
9 | 9 | doc.output = Jekyll::Renderer.new(doc.site, doc).run |
10 | 10 | end |
11 | 11 |
|
| 12 | + before_each { ENV["JEKYLL_GITHUB_TOKEN"] = nil } |
12 | 13 |
|
13 | 14 | context "valid gist" do |
14 | 15 | context "with user prefix" do |
|
18 | 19 | it "produces the correct script tag" do |
19 | 20 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/) |
20 | 21 | end |
21 | | - it "produces the correct noscript tag" do |
| 22 | + it "produces the correct noscript tag" do |
22 | 23 | expect(output).to match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
23 | 24 | end |
24 | 25 | end |
|
30 | 31 | it "produces the correct script tag" do |
31 | 32 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/) |
32 | 33 | end |
33 | | - it "produces the correct noscript tag" do |
| 34 | + it "produces the correct noscript tag" do |
34 | 35 | expect(output).to match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
35 | 36 | end |
36 | 37 | end |
|
42 | 43 | it "produces the correct script tag" do |
43 | 44 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/) |
44 | 45 | end |
45 | | - it "produces the correct noscript tag" do |
| 46 | + it "produces the correct noscript tag" do |
46 | 47 | expect(output).to match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
47 | 48 | end |
48 | 49 | end |
|
56 | 57 | it "produces the correct script tag" do |
57 | 58 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js\?file=#{filename}">\s<\/script>/) |
58 | 59 | end |
59 | | - it "produces the correct noscript tag" do |
| 60 | + it "produces the correct noscript tag" do |
60 | 61 | expect(output).to match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
61 | 62 | end |
62 | 63 | end |
|
74 | 75 | it "produces the correct script tag" do |
75 | 76 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{doc.data['gist_id']}.js">\s<\/script>/) |
76 | 77 | end |
77 | | - it "produces the correct noscript tag" do |
| 78 | + it "produces the correct noscript tag" do |
78 | 79 | expect(output).to match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
79 | 80 | end |
80 | 81 | end |
|
97 | 98 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{doc.data['gist_id']}.js\?file=#{doc.data['gist_filename']}">\s<\/script>/) |
98 | 99 | end |
99 | 100 |
|
100 | | - it "produces the correct noscript tag" do |
| 101 | + it "produces the correct noscript tag" do |
101 | 102 | expect(output).to match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
102 | 103 | end |
103 | 104 | end |
104 | 105 |
|
105 | | - context "with valid gist id and invalid filename" do |
| 106 | + context "with valid gist id and invalid filename" do |
106 | 107 | before { stub_request(:get, "https://gist.githubusercontent.com/#{gist_id}/raw/#{gist_filename}").to_return(status: 404) } |
107 | 108 | let(:gist_id) { "mattr-/24081a1d93d2898ecf0f" } |
108 | 109 | let(:gist_filename) { "myfile.ext" } |
|
112 | 113 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist_id}.js\?file=#{gist_filename}">\s<\/script>/) |
113 | 114 | end |
114 | 115 |
|
115 | | - it "does not produce the noscript tag" do |
| 116 | + it "does not produce the noscript tag" do |
116 | 117 | expect(output).to_not match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
117 | 118 | end |
118 | 119 |
|
119 | 120 | end |
120 | 121 |
|
121 | | - end |
| 122 | + context "with token" do |
| 123 | + before { ENV["JEKYLL_GITHUB_TOKEN"] = "1234" } |
| 124 | + let(:gist_id) { "1342013" } |
| 125 | + let(:gist) { "page.gist_id" } |
| 126 | + let(:output) do |
| 127 | + doc.data['gist_id'] = gist_id |
| 128 | + doc.content = content |
| 129 | + doc.output = Jekyll::Renderer.new(doc.site, doc).run |
| 130 | + end |
| 131 | + |
| 132 | + it "produces the noscript tag" do |
| 133 | + expect(output).to match(/<noscript><pre><test>true<\/test><\/pre><\/noscript>\n/) |
| 134 | + end |
122 | 135 |
|
| 136 | + end |
| 137 | + |
| 138 | + end |
123 | 139 |
|
124 | 140 | context "invalid gist" do |
125 | 141 |
|
|
0 commit comments