Sha256: 1ec7ccc908532dee041f02210b05db04afac67977ee5ce786d35096fd67466c0

Contents?: true

Size: 910 Bytes

Versions: 14

Compression:

Stored size: 910 Bytes

Contents

require 'test_helper'

class ErrorTest < Test::Unit::TestCase
  context "Errors in general" do
    should "be creatable with just a message string" do
      begin
        raise BERTRPC::BERTRPCError.new('msg')
      rescue Object => e
        assert_equal "msg", e.message
        assert_equal 0, e.code
      end
    end

    should "be creatable with a [code, message] array" do
      begin
        raise BERTRPC::BERTRPCError.new([7, 'msg'])
      rescue Object => e
        assert_equal "msg", e.message
        assert_equal 7, e.code
      end
    end

    should "record the original exception" do
      begin
        raise BERTRPC::BERTRPCError.new('msg', 'Error', ['foo', 'bar'])
      rescue Object => e
        assert_equal "msg", e.message
        assert_equal "Error: msg", e.original_exception.message
        assert_equal ['foo', 'bar'], e.original_exception.backtrace
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
bertrpc-1.3.1 test/error_test.rb
fd-bertrpc-1.3.1 test/error_test.rb
fd-bertrpc-1.3.0 test/error_test.rb
bertrpc-1.3.0 test/error_test.rb
bertrpc-1.2.1 test/error_test.rb
bertrpc-1.2.0 test/error_test.rb
bertrpc-0.4.2 test/error_test.rb
bertrpc-1.1.2 test/error_test.rb
bertrpc-0.4.1 test/error_test.rb
bertrpc-1.1.1 test/error_test.rb
bertrpc-1.1.0 test/error_test.rb
bertrpc-1.0.0 test/error_test.rb
bertrpc-0.4.0 test/error_test.rb
bertrpc-0.3.4 test/error_test.rb