Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 0e57be07e7
...
compare: 5a123a3807
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
View
2  Gemfile.lock
@@ -27,7 +27,7 @@ GEM
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
- toadhopper (1.1)
+ toadhopper (2.0)
treetop (1.4.9)
polyglot (>= 0.3.1)
yard (0.6.7)
View
9 lib/safely/strategy/hoptoad.rb
@@ -6,7 +6,8 @@ class << self
# Hoptoad API key to use for reporting errors
attr_accessor :hoptoad_key
-
+ attr_accessor :hoptoad_host
+
def load!
begin
require 'toadhopper'
@@ -16,13 +17,15 @@ def load!
end
def report!( exception )
+ params = {}
+ params[:notify_host] = self.hoptoad_host if !self.hoptoad_host.nil?
+
if defined?( Toadhopper ) && !self.hoptoad_key.nil?
- Toadhopper( self.hoptoad_key ).post!( exception )
+ Toadhopper.new(self.hoptoad_key, params).post!(exception)
end
end
end
-
end
end
end
View
19 spec/strategies/hoptoad_spec.rb
@@ -1,15 +1,32 @@
require 'spec_helper'
describe Safely::Strategy::Hoptoad do
+
it "should be configurable" do
Safely::Strategy::Hoptoad.should respond_to(:hoptoad_key)
Safely::Strategy::Hoptoad.should respond_to(:hoptoad_key=)
+ Safely::Strategy::Hoptoad.should respond_to(:hoptoad_host)
+ Safely::Strategy::Hoptoad.should respond_to(:hoptoad_host=)
+ end
+
+ it "should send the hoptoad_host when config set" do
+ Safely::Strategy::Hoptoad.hoptoad_key = "foo"
+ Safely::Strategy::Hoptoad.hoptoad_host = "http://foo"
+
+ toadhopper_instance = mock(:post!)
+ Toadhopper.expects(:new).with("foo", { :notify_host => "http://foo" }).returns(toadhopper_instance)
+
+ safely do
+ raise "Argh"
+ end
end
it "should report when configured" do
Safely::Strategy::Hoptoad.hoptoad_key = "foo"
+ Safely::Strategy::Hoptoad.hoptoad_host = nil
- Toadhopper.any_instance.expects(:post!)
+ toadhopper_instance = mock(:post!)
+ Toadhopper.expects(:new).with("foo", {}).returns(toadhopper_instance)
safely do
raise "Argh"

No commit comments for this range

Something went wrong with that request. Please try again.