Sha256: b20dd07fafe251844dc754882109007d2109f05d1aceb00e2c151fbc84b3f90a
Contents?: true
Size: 906 Bytes
Versions: 7
Compression:
Stored size: 906 Bytes
Contents
require 'spec_helper' require 'integration/automatic_validation/spec_helper' describe 'A model with a :set & :default options on a property' do before :all do class ::LimitedBoat include DataMapper::Resource property :id, DataMapper::Types::Serial property :limited, String, :set => %w[ foo bar bang ], :default => 'foo' end end describe "without value on that property" do before :all do @model = LimitedBoat.new end # default value is respected it_should_behave_like "valid model" end describe "without value on that property that is not in allowed range/set" do before :all do @model = LimitedBoat.new(:limited => "blah") end it_should_behave_like "invalid model" it "has a meaningful error message" do @model.errors.on(:limited).should == [ 'Limited must be one of foo, bar, bang' ] end end end
Version data entries
7 entries across 7 versions & 1 rubygems