Sha256: e54eb534bddb168cb6fa96ff900e09660b7904299ce3ae308024e3d586b68e8d
Contents?: true
Size: 944 Bytes
Versions: 9
Compression:
Stored size: 944 Bytes
Contents
require 'spec_helper' class ::TestSaveFailure < Volt::Model validate :name, length: 5 end describe Volt::Buffer do it 'should let you pass a block that evaluates to the then of the promise' do buffer = the_page._items!.buffer count = 0 result = buffer.save! do count += 1 end expect(count).to eq(1) expect(result.class).to eq(Promise) end if RUBY_PLATFORM != 'opal' it 'should reject a failed save! with the errors object' do buffer = the_page._test_save_failures.buffer buffer._name = 'Ryan' then_count = 0 fail_count = 0 error = nil buffer.save!.then do then_count += 1 end.fail do |err| fail_count += 1 error = err end expect(then_count).to eq(0) expect(fail_count).to eq(1) expect(error.class).to eq(Volt::Errors) expect(error).to eq(name: ['must be at least 5 characters']) end end end
Version data entries
9 entries across 9 versions & 1 rubygems