Sha256: eae0e4eb63be5d7923737d85aeaf4bf7496cf7bd9a3d7b233953616f5711443f
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
require 'spec_helper' require 'integration/absent_field_validator/spec_helper' describe 'DataMapper::Validate::Fixtures::Kayak' do before :all do DataMapper::Validate::Fixtures::Kayak.auto_migrate! @kayak = DataMapper::Validate::Fixtures::Kayak.new @kayak.should be_valid_for_sale end describe "with salesman being non blank" do before :all do @kayak.salesman = 'Joe' end it "is invalid" do @kayak.should_not be_valid_for_sale end it "has meaningful error message" do @kayak.errors.on(:salesman).should == [ 'Salesman must be absent' ] end end describe "with salesman being nil" do before :all do @kayak.salesman = nil end it "is valid" do @kayak.should be_valid_for_sale end it "has no error messages" do @kayak.errors.on(:salesman).should be_blank end end describe "with salesman being an empty string" do before :all do @kayak.salesman = '' end it "is valid" do @kayak.should be_valid_for_sale end it "has no error messages" do @kayak.errors.on(:salesman).should be_blank end end describe "with salesman being a string of white spaces" do before :all do @kayak.salesman = ' ' end it "is valid" do @kayak.should be_valid_for_sale end it "has no error messages" do @kayak.errors.on(:salesman).should be_blank end end end describe 'DataMapper::Validate::Fixtures::Pirogue' do before :all do DataMapper::Validate::Fixtures::Pirogue.auto_migrate! @kayak = DataMapper::Validate::Fixtures::Pirogue.new @kayak.should_not be_valid_for_sale end describe "by default" do it "is invalid" do @kayak.should_not be_valid_for_sale end it "has meaningful error message" do @kayak.errors.on(:salesman).should == [ 'Salesman must be absent' ] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dm-validations-0.10.2 | spec/integration/absent_field_validator/absent_field_validator_spec.rb |