Sha256: 7f07ccb818da10a512461556f6a867eab873d7efdca1026f969dc8dac66ebee8
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require_relative '../../../spec_helper' require_relative '../factories/shift' describe Meeting do context "Validation" do before(:all) do Shift.delete_all end it "create meeting" do lambda { FactoryGirl.create(:shift) }.should change(Shift, :count).by(1) 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) shift.should_not be_valid shift.errors[:starts_at].should_not be_empty shift.errors[:ends_at].should be_empty shift = FactoryGirl.build(:shift, :starts_at => "2011-01-01".to_date, :ends_at => "2011-01-04".to_date) shift.should_not be_valid shift.errors[:starts_at].should_not be_empty shift.errors[:ends_at].should 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) shift.should be_valid shift.errors[:starts_at].should be_empty shift.errors[:ends_at].should be_empty shift = FactoryGirl.build(:shift, :starts_at => "2011-01-01".to_date, :ends_at => "2011-01-02".to_date) shift.should be_valid shift.errors[:starts_at].should be_empty shift.errors[:ends_at].should be_empty end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_overlap-0.6.0 | spec/dummy/spec/models/shift_spec.rb |