Skip to content

Commit 965917b

Browse files
committed
Add failing test
1 parent 56fc584 commit 965917b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spec/gist_tag_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,25 @@
4949
end
5050

5151
context "with file specified" do
52-
before { stub_request(:get, "https://gist.githubusercontent.com/#{gist}/raw/#{filename}").to_return(:body => http_output) }
52+
before { stub_request(:get, %r!https://gist.githubusercontent.com/#{gist}/raw/.*!).to_return(:body => http_output) }
5353
let(:gist) { "mattr-/24081a1d93d2898ecf0f" }
5454
let(:filename) { "myfile.ext" }
5555
let(:content) { "{% gist #{gist} #{filename} %}" }
5656

5757
it "produces the correct script tag" do
58-
expect(output).to match(%r!<script src="https:\/\/gist.github.com\/#{gist}.js\?file=#{filename}">\s<\/script>!)
58+
expect(output).to match(%r!<script src="https://gist.github.com/#{gist}.js\?file=#{filename}">\s<\/script>!)
5959
end
6060
it "produces the correct noscript tag" do
6161
expect(output).to match(%r!<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n!)
6262
end
63+
64+
context "with octothorpe in filename" do
65+
let(:filename) { "my#file" }
66+
67+
it "removes special characters from the filename" do
68+
expect(output).to match(%r!<script src="https://gist.github.com/#{gist}.js\?file=myfile">\s</script>!)
69+
end
70+
end
6371
end
6472

6573
context "with variable gist id" do

0 commit comments

Comments
 (0)