Sha256: ea68a94c8bfe52590229faef814582ff31cd667f955f0a66871772703d4869d8
Contents?: true
Size: 1.4 KB
Versions: 76
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true require 'rails_helper' describe LHS::Item do before do class Presence < LHS::Record endpoint 'http://opm/presence' end I18n.reload! I18n.backend.store_translations(:en, YAML.safe_load(%q{ lhs: warnings: records: presence: will_be_resized: 'The photos will be resized' })) end it 'provides warnings together with validation errors' do stub_request(:post, "http://opm/presence?synchronize=false") .to_return( body: { field_warnings: [{ code: 'WILL_BE_RESIZED', path: ['place', 'photos', 0], message: 'The image will be resized.' }], place: { href: 'http://storage/places/1', photos: [{ href: 'http://bin.staticlocal.ch/123', width: 10, height: 10 }] } }.to_json ) presence = Presence.options(params: { synchronize: false }).create( place: { href: 'http://storage/places/1' } ) expect(presence.warnings.any?).to eq true expect(presence.place.warnings.any?).to eq true expect(presence.place.photos.warnings.any?).to eq true expect(presence.place.photos[0].warnings.any?).to eq true expect(presence.place.photos[0].warnings.messages.first).to eq( 'The photos will be resized' ) end end
Version data entries
76 entries across 76 versions & 1 rubygems