<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>script/integration_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,7 @@
 require 'net/http'
+require 'net/https'
+require 'rubygems'
+require 'active_support'
 
 # Plugin for applications to automatically post errors to the Hoptoad of their choice.
 module HoptoadNotifier
@@ -58,6 +61,13 @@ module HoptoadNotifier
     end
     
     # Call this method to modify defaults in your initializers.
+    #
+    # HoptoadNotifier.configure do |config|
+    #   config.api_key = '1234567890abcdef'
+    #   config.secure  = false
+    # end
+    #
+    # NOTE: secure connections are not yet supported.
     def configure
       yield self
     end
@@ -105,8 +115,10 @@ module HoptoadNotifier
   end
 
   filter_backtrace do |line|
-    Gem.path.inject(line) do |line, path|
-      line.gsub(/#{path}/, &quot;[GEM_ROOT]&quot;)
+    if defined?(Gem)
+      Gem.path.inject(line) do |line, path|
+        line.gsub(/#{path}/, &quot;[GEM_ROOT]&quot;)
+      end
     end
   end
 
@@ -217,7 +229,7 @@ module HoptoadNotifier
         }
         http.read_timeout = 5 # seconds
         http.open_timeout = 2 # seconds
-        # http.use_ssl = HoptoadNotifier.secure
+        http.use_ssl = !!HoptoadNotifier.secure 
         response = begin
                      http.post(url.path, stringify_keys(data).to_yaml, headers)
                    rescue TimeoutError =&gt; e</diff>
      <filename>lib/hoptoad_notifier.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,8 +5,6 @@ require 'shoulda'
 require 'action_controller'
 require 'action_controller/test_process'
 require 'active_record'
-require 'net/http'
-require 'net/https'
 require File.join(File.dirname(__FILE__), &quot;..&quot;, &quot;lib&quot;, &quot;hoptoad_notifier&quot;)
 
 RAILS_ROOT = File.join( File.dirname(__FILE__), &quot;rails_root&quot; )
@@ -355,6 +353,66 @@ class HoptoadNotifierTest &lt; Test::Unit::TestCase
         @sender.stubs(:public_environment?).returns(true)
       end
 
+      context &quot;when stubbing out Net::HTTP&quot; do
+        setup do
+          @body = 'body'
+          @response = stub(:body =&gt; @body)
+          @http = stub(:post =&gt; @response, :read_timeout= =&gt; nil, :open_timeout= =&gt; nil, :use_ssl= =&gt; nil)
+          @sender.stubs(:logger).returns(stub(:error =&gt; nil, :info =&gt; nil))
+          Net::HTTP.stubs(:start).yields(@http)
+          HoptoadNotifier.port = nil
+          HoptoadNotifier.host = nil
+        end
+
+        context &quot;on notify&quot; do
+          setup { HoptoadNotifier.notify(@exception) }
+
+          before_should &quot;post to the right url for non-ssl&quot; do
+            HoptoadNotifier.secure = false
+            url = &quot;http://hoptoadapp.com:80/notices/&quot;
+            uri = URI.parse(url)
+            URI.expects(:parse).with(url).returns(uri)
+            @http.expects(:post).with(uri.path, anything, anything).returns(@response)
+          end
+
+          before_should &quot;post to the right path&quot; do
+            @http.expects(:post).with(&quot;/notices/&quot;, anything, anything).returns(@response)
+          end
+
+          before_should &quot;call send_to_hoptoad&quot; do
+            @sender.expects(:send_to_hoptoad)
+          end
+
+          before_should &quot;set the open timeout to 2 seconds&quot; do
+            @http.expects(:open_timeout=).with(2)
+          end
+
+          before_should &quot;set the read timeout to 5 seconds&quot; do
+            @http.expects(:read_timeout=).with(5)
+          end
+
+          before_should &quot;connect to the right port for ssl&quot; do
+            HoptoadNotifier.secure = true
+            Net::HTTP.expects(:start).with(&quot;hoptoadapp.com&quot;, 443).yields(@http)
+          end
+
+          before_should &quot;connect to the right port for non-ssl&quot; do
+            HoptoadNotifier.secure = false
+            Net::HTTP.expects(:start).with(&quot;hoptoadapp.com&quot;, 80).yields(@http)
+          end
+
+          before_should &quot;use ssl if secure&quot; do
+            HoptoadNotifier.secure = true
+            @http.expects(:use_ssl=).with(true)
+          end
+
+          before_should &quot;not use ssl if not secure&quot; do
+            HoptoadNotifier.secure = nil
+            @http.expects(:use_ssl=).with(false)
+          end
+        end
+      end
+
       should &quot;send as if it were a normally caught exception&quot; do
         @sender.expects(:notify_hoptoad).with(@exception)
         HoptoadNotifier.notify(@exception)</diff>
      <filename>test/hoptoad_notifier_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9b00fbd4fb4cadc0dd6bde631a2dd4f00eab24ff</id>
    </parent>
    <parent>
      <id>bdd26b36fab9f52951c6f6a2626b93d90dfa68b1</id>
    </parent>
  </parents>
  <author>
    <name>Jon Yurek</name>
    <email>jyurek@thoughtbot.com</email>
  </author>
  <url>http://github.com/methodmissing/hoptoad_notifier/commit/38056601e3cc15a086df0e19d2ffcb585127a0fe</url>
  <id>38056601e3cc15a086df0e19d2ffcb585127a0fe</id>
  <committed-date>2008-11-19T08:56:15-08:00</committed-date>
  <authored-date>2008-11-19T08:56:15-08:00</authored-date>
  <message>Merge branch 'master' of git@github.com:thoughtbot/hoptoad_notifier</message>
  <tree>922f8a9269964fa86cbf4b7e83cfe5476eb8102e</tree>
  <committer>
    <name>Jon Yurek</name>
    <email>jyurek@thoughtbot.com</email>
  </committer>
</commit>
