Sha256: 6d1e150b05d6a7007ab97aaa3651b7da6e1406d671dd1ecd94c9174ec03b0f3e

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

require 'helper'
require 'peddler/errors/error'

class TestPeddlerErrorsError < MiniTest::Test
  def setup
    @cause = OpenStruct.new(response: 'response')
    @error = Peddler::Errors::Error.new('message', @cause)
  end

  def test_message
    assert_equal 'message', @error.message
  end

  def test_cause
    assert_equal @cause, @error.cause
  end

  def test_that_it_defines_common_errors
    Peddler::Errors::CODES.each do |name|
      assert ::Peddler::Errors.const_defined?(name)
    end
  end

  def test_that_it_allows_nil_arguments
    Peddler::Errors::Error.new
  end

  def test_that_it_delegates_response_to_cause
    assert_equal @cause.response, @error.response
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
peddler-2.1.1 test/unit/peddler/errors/test_error.rb
peddler-2.1.0 test/unit/peddler/errors/test_error.rb