From f4af812a28b03508c96853739aea53f7a6714abf Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 13 Nov 2012 20:22:13 +0000 Subject: tests: remove assert_nothing_raised (part 2) assert_nothing_raised ends up hiding errors and backtraces, making things harder to debug. Since Test::Unit already fails on uncaught exceptions, there is no need to assert on the lack of exceptions for a successful test run. This is a followup to commit 5acf5522295c947d3118926d1a1077007f615de9 --- test/unit/test_configurator.rb | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'test/unit/test_configurator.rb') diff --git a/test/unit/test_configurator.rb b/test/unit/test_configurator.rb index c19c427..267eea3 100644 --- a/test/unit/test_configurator.rb +++ b/test/unit/test_configurator.rb @@ -9,7 +9,7 @@ TestStruct = Struct.new( class TestConfigurator < Test::Unit::TestCase def test_config_init - assert_nothing_raised { Unicorn::Configurator.new {} } + Unicorn::Configurator.new {} end def test_expand_addr @@ -66,7 +66,7 @@ class TestConfigurator < Test::Unit::TestCase def test_config_defaults cfg = Unicorn::Configurator.new(:use_defaults => true) test_struct = TestStruct.new - assert_nothing_raised { cfg.commit!(test_struct) } + cfg.commit!(test_struct) Unicorn::Configurator::DEFAULTS.each do |key,value| assert_equal value, test_struct.__send__(key) end @@ -76,7 +76,7 @@ class TestConfigurator < Test::Unit::TestCase cfg = Unicorn::Configurator.new(:use_defaults => true) skip = [ :logger ] test_struct = TestStruct.new - assert_nothing_raised { cfg.commit!(test_struct, :skip => skip) } + cfg.commit!(test_struct, :skip => skip) Unicorn::Configurator::DEFAULTS.each do |key,value| next if skip.include?(key) assert_equal value, test_struct.__send__(key) @@ -89,12 +89,9 @@ class TestConfigurator < Test::Unit::TestCase expect = { :sndbuf => 1, :rcvbuf => 2, :backlog => 10 }.freeze listener = "127.0.0.1:12345" tmp.syswrite("listen '#{listener}', #{expect.inspect}\n") - cfg = nil - assert_nothing_raised do - cfg = Unicorn::Configurator.new(:config_file => tmp.path) - end + cfg = Unicorn::Configurator.new(:config_file => tmp.path) test_struct = TestStruct.new - assert_nothing_raised { cfg.commit!(test_struct) } + cfg.commit!(test_struct) assert(listener_opts = test_struct.listener_opts) assert_equal expect, listener_opts[listener] end @@ -124,9 +121,7 @@ class TestConfigurator < Test::Unit::TestCase expect = { :delay => 0.5 } listener = "127.0.0.1:12345" tmp.syswrite("listen '#{listener}', #{expect.inspect}\n") - assert_nothing_raised do - Unicorn::Configurator.new(:config_file => tmp.path) - end + Unicorn::Configurator.new(:config_file => tmp.path) end def test_listen_option_int_delay @@ -134,9 +129,7 @@ class TestConfigurator < Test::Unit::TestCase expect = { :delay => 5 } listener = "127.0.0.1:12345" tmp.syswrite("listen '#{listener}', #{expect.inspect}\n") - assert_nothing_raised do - Unicorn::Configurator.new(:config_file => tmp.path) - end + Unicorn::Configurator.new(:config_file => tmp.path) end def test_after_fork_proc -- cgit v1.2.3-24-ge0c7