Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added missing test if no https is on the link

  • Loading branch information...
commit a430f544a4a0f590929bdfb0751e9b6215b101f3 1 parent 7bb6222
Dave Kennedy authored
1  lib/rack/gist.rb
@@ -12,6 +12,7 @@ def call(env)
12 12
         parsed_response = ""
13 13
         response.each do |r|
14 14
           parsed_response = r.gsub(/(https:\/\/|)gist\.github\.com\/(\d+)/) do |gist|
  15
+            gist = "https://" + gist unless gist.start_with? "https://"
15 16
             "<script src=\"#{gist}.js\"></script>"
16 17
           end
17 18
         end
10  spec/rack/gist_spec.rb
@@ -52,5 +52,15 @@ def generate_app(options={})
52 52
     end
53 53
   end
54 54
 
  55
+  describe "a page with a gist with no https protocol in the body" do
  56
+    before do
  57
+      self.class.app = generate_app(body: '<p>Here is some text</p><p>gist.github.com/12345</p><p>Some more text</p>')
  58
+    end
  59
+
  60
+    it "should parse out plain text gist links to js stylee" do
  61
+      get "/"
  62
+      body.should eql '<p>Here is some text</p><p><script src="https://gist.github.com/12345.js"></script></p><p>Some more text</p>'
  63
+    end
  64
+  end
55 65
   
56 66
 end

0 notes on commit a430f54

Please sign in to comment.
Something went wrong with that request. Please try again.