spec/strategies/hoptoad_spec.rb in safely-0.3.1 vs spec/strategies/hoptoad_spec.rb in safely-0.3.2
- old
+ new
@@ -1,16 +1,33 @@
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"
end
end