Sha256: b7ab87ec335ae3752a52d4e09b1513a558d2dd351283dfdf708db4f80ecf731b
Contents?: true
Size: 951 Bytes
Versions: 1
Compression:
Stored size: 951 Bytes
Contents
require 'spec_helper' module Kangaroo describe Model::RequiredAttributes do before :all do config = Kangaroo::Util::Configuration.new 'spec/test_env/test.yml' config.login Kangaroo::Util::Loader.new('res.country', config.database, 'RequiredAttributesSpec').load! end after :each do @cleanup && @cleanup.call end it 'validates required fields' do c = RequiredAttributesSpec::Res::Country.new :name => 'ABCXYZ' c.valid?.should_not == true c.errors.keys.should include :code end it 'refuses to save invalid records' do a = RequiredAttributesSpec::Res::Country.where(:name => 'ABCXYZ').first a && a.destroy c = RequiredAttributesSpec::Res::Country.new :name => 'ABCXYZ' c.save.should_not == true c.errors.keys.should include :code lambda { c.save! }.should raise_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kangaroo-0.1.0.alpha1 | spec/functional/required_attributes_spec.rb |