0
@@ -33,7 +33,7 @@ class HoptoadController < ActionController::Base
0
-class Hoptoad
NotifierTest < Test::Unit::TestCase
0
+class Hoptoad
Test < Test::Unit::TestCase
0
def request(action = nil, method = :get)
0
@request = ActionController::TestRequest.new({
0
"controller" => "hoptoad",
0
@@ -48,7 +48,7 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
should "be able to occur even outside Rails controllers" do
0
assert_nothing_raised do
0
- include Hoptoad
Notifier::Catcher
0
+ include Hoptoad
::Catcher
0
@@ -56,11 +56,11 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
- context "Hoptoad
Notifier configuration" do
0
+ context "Hoptoad
configuration" do
0
@controller = HoptoadController.new
0
class ::HoptoadController
0
- include Hoptoad
Notifier::Catcher
0
+ include Hoptoad
::Catcher
0
rescue_action_in_public e
0
@@ -69,7 +69,7 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
should "be done with a block" do
0
- Hoptoad
Notifier.configure do |config|
0
+ Hoptoad
.configure do |config|
0
@@ -77,21 +77,21 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
config.ignore << [ RuntimeError ]
0
- assert_equal "host", HoptoadNotifier.host
0
- assert_equal 3333, HoptoadNotifier.port
0
- assert_equal true, HoptoadNotifier.secure
0
- assert_equal "1234567890abcdef", HoptoadNotifier.api_key
0
- assert_equal (HoptoadNotifier::IGNORE_DEFAULT + [RuntimeError]), HoptoadNotifier.ignore
0
+ assert_equal "host", Hoptoad.host
0
+ assert_equal 3333, Hoptoad.port
0
+ assert_equal true, Hoptoad.secure
0
+ assert_equal "1234567890abcdef", Hoptoad.api_key
0
+ assert_equal (Hoptoad::IGNORE_DEFAULT + [RuntimeError]), Hoptoad.ignore
0
should "set a default host" do
0
- HoptoadNotifier.instance_variable_set("@host",nil)
0
- assert_equal "hoptoadapp.com", HoptoadNotifier.host
0
+ Hoptoad.instance_variable_set("@host",nil)
0
+ assert_equal "hoptoadapp.com", Hoptoad.host
0
should "add filters to the backtrace_filters" do
0
- assert_difference "HoptoadNotifier.backtrace_filters.length" do
0
- HoptoadNotifier.configure do |config|
0
+ assert_difference "Hoptoad.backtrace_filters.length" do
0
+ Hoptoad.configure do |config|
0
config.filter_backtrace do |line|
0
@@ -100,19 +100,19 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
should "add filters to the params filters" do
0
- assert_difference "HoptoadNotifier.params_filters.length", 2 do
0
- HoptoadNotifier.configure do |config|
0
+ assert_difference "Hoptoad.params_filters.length", 2 do
0
+ Hoptoad.configure do |config|
0
config.params_filters << "abc"
0
config.params_filters << "def"
0
- assert HoptoadNotifier.params_filters.include?( "abc" )
0
- assert HoptoadNotifier.params_filters.include?( "def" )
0
+ assert Hoptoad.params_filters.include?( "abc" )
0
+ assert Hoptoad.params_filters.include?( "def" )
0
should "have at default ignored exceptions" do
0
- assert Hoptoad
Notifier::IGNORE_DEFAULT.any?
0
+ assert Hoptoad
::IGNORE_DEFAULT.any?
0
@@ -143,12 +143,12 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
context "with the notifier installed" do
0
class ::HoptoadController
0
- include Hoptoad
Notifier::Catcher
0
+ include Hoptoad
::Catcher
0
rescue_action_in_public e
0
- Hoptoad
Notifier.ignore_only = HoptoadNotifier::IGNORE_DEFAULT
0
+ Hoptoad
.ignore_only = Hoptoad::IGNORE_DEFAULT
0
@controller.stubs(:public_environment?).returns(true)
0
@connection = mock('Connection')
0
Hoptoad::Connection.stubs(:new).returns(@connection)
0
@@ -218,7 +218,7 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
context "and configured to ignore additional exceptions" do
0
- Hoptoad
Notifier.ignore << ActiveRecord::StatementInvalid
0
+ Hoptoad
.ignore << ActiveRecord::StatementInvalid
0
should "still ignore default exceptions" do
0
@@ -248,7 +248,7 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
context "and configured to ignore only certain exceptions" do
0
- Hoptoad
Notifier.ignore_only = [ActiveRecord::StatementInvalid]
0
+ Hoptoad
.ignore_only = [ActiveRecord::StatementInvalid]
0
should "no longer ignore default exceptions" do
0
@@ -281,7 +281,7 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
context "Sending a notice" do
0
context "with an exception" do
0
- @sender = Hoptoad
Notifier::Sender.new
0
+ @sender = Hoptoad
::Sender.new
0
@@ -290,29 +290,29 @@ class HoptoadNotifierTest < Test::Unit::TestCase
0
@options = {:error_message => "123",
0
:backtrace => @backtrace}
0
- HoptoadNotifier.instance_variable_set("@backtrace_filters", [])
0
- HoptoadNotifier::Sender.expects(:new).returns(@sender)
0
+ Hoptoad.instance_variable_set("@backtrace_filters", [])
0
+ Hoptoad::Sender.expects(:new).returns(@sender)
0
@sender.stubs(:public_environment?).returns(true)
0
should "send as if it were a normally caught exception" do
0
@sender.expects(:notify_hoptoad).with(@exception)
0
- Hoptoad
Notifier.notify(@exception)
0
+ Hoptoad
.notify(@exception)
0
context "without an exception" do
0
- @sender = Hoptoad
Notifier::Sender.new
0
+ @sender = Hoptoad
::Sender.new
0
@options = {:error_message => "123",
0
:backtrace => @backtrace}
0
- Hoptoad
Notifier::Sender.expects(:new).returns(@sender)
0
+ Hoptoad
::Sender.expects(:new).returns(@sender)
0
should "send sensible defaults" do
0
@sender.expects(:notify_hoptoad).with(@options)
0
- Hoptoad
Notifier.notify(:error_message => "123", :backtrace => @backtrace)
0
+ Hoptoad
.notify(:error_message => "123", :backtrace => @backtrace)
should be:
Well spotted!