test/unit/peddler/errors/test_error.rb in peddler-1.6.7 vs test/unit/peddler/errors/test_error.rb in peddler-2.0.0

- old
+ new

@@ -3,26 +3,31 @@ require 'helper' require 'peddler/errors/error' class TestPeddlerErrorsError < MiniTest::Test def setup - @error = Peddler::Errors::Error.new('message', 'cause') + @cause = OpenStruct.new(response: 'response') + @error = Peddler::Errors::Error.new('message', @cause) end def test_sets_message assert_equal 'message', @error.message end def test_sets_cause - assert_equal 'cause', @error.cause + assert_equal @cause, @error.cause end def test_defines_common_errors Peddler::Errors::CODES.each do |name| assert ::Peddler::Errors.const_defined?(name) end end def test_allows_nil_arguments Peddler::Errors::Error.new + end + + def test_delegates_response_to_cause + assert_equal @cause.response, @error.response end end