Sha256: 68f64940cdc06b8eadaac83af96da029640ec7c37ebc6fcd2bd58c7d2b6b4b25

Contents?: true

Size: 787 Bytes

Versions: 76

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe LHS::Item do

  context 'make errors available' do

    before do
      class Presence < LHS::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: ['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

76 entries across 76 versions & 1 rubygems

Version Path
lhs-21.0.0 spec/item/access_errors_spec.rb
lhs-20.1.4 spec/item/access_errors_spec.rb
lhs-20.1.3.pre.paginationfix.3 spec/item/access_errors_spec.rb
lhs-20.1.3.pre.paginationfix.2 spec/item/access_errors_spec.rb
lhs-20.1.3.pre.paginationfix.1 spec/item/access_errors_spec.rb
lhs-20.1.2 spec/item/access_errors_spec.rb
lhs-20.1.1 spec/item/access_errors_spec.rb
lhs-20.0.0 spec/item/access_errors_spec.rb
lhs-19.10.0 spec/item/access_errors_spec.rb
lhs-19.9.0 spec/item/access_errors_spec.rb
lhs-19.8.2 spec/item/access_errors_spec.rb
lhs-19.8.1 spec/item/access_errors_spec.rb
lhs-19.8.0 spec/item/access_errors_spec.rb
lhs-19.7.0 spec/item/access_errors_spec.rb
lhs-19.6.0 spec/item/access_errors_spec.rb
lhs-19.5.0 spec/item/access_errors_spec.rb
lhs-19.5.0.pre.wherehref.1 spec/item/access_errors_spec.rb
lhs-19.4.1 spec/item/access_errors_spec.rb
lhs-19.4.0 spec/item/access_errors_spec.rb
lhs-19.3.1 spec/item/access_errors_spec.rb