|
8 | 8 | doc.output = Jekyll::Renderer.new(doc.site, doc).run |
9 | 9 | end |
10 | 10 |
|
11 | | - context "simple gist" do |
12 | | - let(:gist) { 358471 } |
13 | 11 |
|
14 | | - it "produces the correct script tag" do |
15 | | - expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/) |
| 12 | + context "valid gist" do |
| 13 | + context "with user prefix" do |
| 14 | + let(:gist) { "mattr-/24081a1d93d2898ecf0f" } |
| 15 | + |
| 16 | + it "produces the correct script tag" do |
| 17 | + expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/) |
| 18 | + end |
16 | 19 | end |
17 | | - end |
18 | 20 |
|
19 | | - context "private gist" do |
| 21 | + context "without user prefix" do |
| 22 | + let(:gist) { "28949e1d5ee2273f9fd3" } |
20 | 23 |
|
21 | | - context "when valid" do |
22 | | - let(:gist) { "mattr-/24081a1d93d2898ecf0f" } |
| 24 | + it "produces the correct script tag" do |
| 25 | + expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/) |
| 26 | + end |
| 27 | + end |
| 28 | + |
| 29 | + context "classic Gist id style" do |
| 30 | + let(:gist) { "1234321" } |
23 | 31 |
|
24 | 32 | it "produces the correct script tag" do |
25 | 33 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/) |
|
35 | 43 | expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js\?file=#{filename}">\s<\/script>/) |
36 | 44 | end |
37 | 45 | end |
| 46 | + end |
| 47 | + |
| 48 | + |
| 49 | + context "invalid gist" do |
38 | 50 |
|
39 | | - context "when invalid" do |
40 | | - let(:gist) { "mattr-24081a1d93d2898ecf0f" } |
| 51 | + context "no gist id present" do |
| 52 | + let(:gist) { "" } |
41 | 53 |
|
42 | 54 | it "raises an error" do |
43 | 55 | expect(->{ output }).to raise_error |
|
46 | 58 |
|
47 | 59 | end |
48 | 60 |
|
49 | | - context "no gist id present" do |
50 | | - let(:gist) { "" } |
51 | | - |
52 | | - it "raises an error" do |
53 | | - expect(->{ output }).to raise_error |
54 | | - end |
55 | | - end |
56 | | - |
57 | 61 | end |
0 commit comments