Sha256: 5befc97568ffa0ba7917caa0111c8f32126500a9d7c9646ed93f38b795100ab5

Contents?: true

Size: 745 Bytes

Versions: 20

Compression:

Stored size: 745 Bytes

Contents

require 'spec_helper'

RSpec.describe RDStation::Error do
  describe '.new' do
    context 'with a valid details hash' do
      let(:error_details) { { 'error_message' => 'message', 'error_type' => 'ERROR_TYPE' } }
      let(:result) { described_class.new(error_details) }

      it 'creates a new instance of errors with details' do
        expect(result.details).to eq(error_details)
      end
    end

    context 'with an invalid details hash' do
      let(:error_details) { { 'error_type' => 'ERROR_TYPE' } }

      it 'raises an invalid argument error' do
        expect do
          described_class.new(error_details)
        end.to raise_error(ArgumentError, 'The details hash must contain an error message')
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.8.2 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.8.1 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.8.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.7.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.6.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.5.3 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.5.2 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.5.1 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.5.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.4.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.3.1 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.3.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.2.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.1.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-2.0.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-1.2.1 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-1.2.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-1.1.0 spec/lib/rdstation/error_spec.rb
rdstation-ruby-client-1.0.1 spec/lib/rdstation/error_spec.rb