Sha256: 8f958f147f92ae7962657a6955ca8143273692be1c953430ef5b10ee5b92bc79
Contents?: true
Size: 676 Bytes
Versions: 4
Compression:
Stored size: 676 Bytes
Contents
require 'spec_helper' unless RUBY_PLATFORM == 'opal' class Fridge < Volt::Model validate :name, unique: true end describe 'unique spec' do it 'should reject save if there are records with existing attributes already' do store._fridges << { name: 'swift' } fridge = store._fridges.buffer name: 'swift' fridge.save!.then do expect(false).to be_true end.fail do expect(true).to be_true end end it 'should not increase count of the total records in the store' do store._fridges << { name: 'swift' } store._fridges << { name: 'swift' } expect(store._fridges.count).to eq(1) end end end
Version data entries
4 entries across 4 versions & 1 rubygems