Sha256: 4806bd526f43af3f8d54b597986c5fa9735ecd8cbae756d3b08a41056fe7486c
Contents?: true
Size: 1.37 KB
Versions: 19
Compression:
Stored size: 1.37 KB
Contents
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
19 entries across 19 versions & 1 rubygems