Sha256: e005c51428107b374e871c645b90dfdfbe566ac229a736a9706a2c4e7586b4bc
Contents?: true
Size: 789 Bytes
Versions: 6
Compression:
Stored size: 789 Bytes
Contents
describe OverlapValidator do context "validation message" do it "should have default message" do subject = OverlapValidator.new({:attributes => [:starts_at, :ends_at]}) meeting = Meeting.new subject.stub(:find_crossed){true} subject.validate(meeting) meeting.errors[:starts_at].should eq ["overlaps with another record"] end it "should be possible to configure message" do subject = OverlapValidator.new({:attributes => [:starts_at, :ends_at]}) meeting = Meeting.new subject.stub(:find_crossed){true} subject.stub(:options){ {:message_title => :optional_key, :message_content => "Message content"} } subject.validate(meeting) meeting.errors[:optional_key].should eq ["Message content"] end end end
Version data entries
6 entries across 6 versions & 1 rubygems