Sha256: 306e26a38630e8b1126eba1d83331fbf151ba60998f2d241efd6f9765bb90c67

Contents?: true

Size: 782 Bytes

Versions: 12

Compression:

Stored size: 782 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe DHS::Item do
  context 'make errors available' do
    before do
      class Presence < DHS::Record
        endpoint 'http://opm/presences'
      end
    end

    let(:place_href) { 'http://datastore/places/1' }

    it 'makes errors available no matter the response code' do
      stub_request(:post, 'http://opm/presences')
        .to_return(
          status: 200,
          body: {
            place: { href: place_href },
            field_errors: [{
              code: 'REQUIRED_PROPERTY_VALUE',
              path: %w[place opening_hours]
            }]
          }.to_json
        )
      presence = Presence.create(place: { href: place_href })
      expect(presence.errors.any?).to be true
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 spec/item/access_errors_spec.rb
dhs-1.5.0 spec/item/access_errors_spec.rb
dhs-1.4.2 spec/item/access_errors_spec.rb
dhs-1.4.1 spec/item/access_errors_spec.rb
dhs-1.4.0 spec/item/access_errors_spec.rb
dhs-1.3.0 spec/item/access_errors_spec.rb
dhs-1.2.0 spec/item/access_errors_spec.rb
dhs-1.1.0 spec/item/access_errors_spec.rb
dhs-1.0.3 spec/item/access_errors_spec.rb
dhs-1.0.2 spec/item/access_errors_spec.rb
dhs-1.0.1 spec/item/access_errors_spec.rb
dhs-1.0.0 spec/item/access_errors_spec.rb