Sha256: 49f64fb66786c01274b99b018010c1990b7247c8dd1f5e3c0d946d4f7fff2478
Contents?: true
Size: 1.46 KB
Versions: 6
Compression:
Stored size: 1.46 KB
Contents
require "#{File.dirname(__FILE__)}/../../../spec_helper" describe Meeting do context 'Validation' do it 'create meeting' do expect do FactoryGirl.create(:shift) end.to change(Shift, :count).by(1) end context 'validation with shift configuration' do before do FactoryGirl.create(:shift) end it 'is not valid if exists shift within wider range' do shift = FactoryGirl.build(:shift, starts_at: '2011-01-09'.to_date, ends_at: '2011-01-11'.to_date) expect(shift).not_to be_valid expect(shift.errors[:starts_at]).not_to be_empty expect(shift.errors[:ends_at]).to be_empty shift = FactoryGirl.build(:shift, starts_at: '2011-01-01'.to_date, ends_at: '2011-01-04'.to_date) expect(shift).not_to be_valid expect(shift.errors[:starts_at]).not_to be_empty expect(shift.errors[:ends_at]).to be_empty end it ' validate object which has not got overlap' do shift = FactoryGirl.build(:shift, starts_at: '2011-01-10'.to_date, ends_at: '2011-01-11'.to_date) expect(shift).to be_valid expect(shift.errors[:starts_at]).to be_empty expect(shift.errors[:ends_at]).to be_empty shift = FactoryGirl.build(:shift, starts_at: '2011-01-01'.to_date, ends_at: '2011-01-02'.to_date) expect(shift).to be_valid expect(shift.errors[:starts_at]).to be_empty expect(shift.errors[:ends_at]).to be_empty end end end end
Version data entries
6 entries across 6 versions & 1 rubygems