Sha256: 3e3d5fb0c294f1d7f742f7c49ca2ae53f8293f8dbb4ce42b18e6379fdf2dcc7c
Contents?: true
Size: 800 Bytes
Versions: 2
Compression:
Stored size: 800 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.messages.should eq :optional_key => ["Message content"] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_overlap-0.2.0 | spec/dummy/spec/overlap_validator_spec.rb |
validates_overlap-0.1.3 | spec/dummy/spec/overlap_validator_spec.rb |