Sha256: 345b2f8c93722d6145dbc63472fe2cbbe2405f366a2abc6fbc7bff9a46ee7374
Contents?: true
Size: 845 Bytes
Versions: 25
Compression:
Stored size: 845 Bytes
Contents
require 'spec_helper' RSpec.describe 'Validations' do let(:collection_class) { Employee::Collection } describe 'conditional validations' do let(:record_class){ Employee } it 'is valid without attribute present' do collection_class.new([]).should be_valid end it 'is valid with valid section attribute' do collection_class.new([], section: 'ABC').should be_valid end it 'is invalid with invalid section attribute' do collection_class.new([], section: 'SECTION3').should be_invalid end describe '#save' do it 'does not trigger update_collection_attributes! for invalid collection' do collection = collection_class.new [], section: 'INVALID_SECTION_NAME' collection.should_not receive :update_collection_attributes! collection.save end end end end
Version data entries
25 entries across 25 versions & 1 rubygems