Sha256: a872582757d36caf446a3ba0a4b1b177b3aff7c1cdd60674b11a3e63e5d3c54c
Contents?: true
Size: 1.94 KB
Versions: 7
Compression:
Stored size: 1.94 KB
Contents
require 'spec_helper' require 'integration/automatic_validation/spec_helper' describe "A model with a Boolean property" do before :all do @model = HasNullableBoolean.new(:id => 1) end describe "assigned to true" do before :all do @model.set(:bool => true) end it_should_behave_like "valid model" end describe "assigned to false" do before :all do @model.set(:bool => false) end it_should_behave_like "valid model" end describe "assigned to a nil" do before :all do @model.set(:bool => nil) end it_should_behave_like "valid model" end end describe "A model with a required Boolean property" do before :all do @model = HasNotNullableBoolean.new(:id => 1) end describe "assigned to true" do before :all do @model.set(:bool => true) end it_should_behave_like "valid model" end describe "assigned to false" do before :all do @model.set(:bool => false) end it_should_behave_like "valid model" end describe "assigned to a nil" do before :all do @model.set(:bool => nil) end it_should_behave_like "invalid model" it "has a meaningful error message" do @model.errors.on(:bool).should == [ 'Bool must not be nil' ] end end end describe "A model with a required paranoid Boolean property" do before :all do @model = HasNotNullableParanoidBoolean.new(:id => 1) end describe "assigned to true" do before :all do @model.set(:bool => true) end it_should_behave_like "valid model" end describe "assigned to false" do before :all do @model.set(:bool => false) end it_should_behave_like "valid model" end describe "assigned to a nil" do before :all do @model.set(:bool => nil) end it_should_behave_like "invalid model" it "has a meaningful error message" do @model.errors.on(:bool).should == [ 'Bool must not be nil' ] end end end
Version data entries
7 entries across 7 versions & 1 rubygems