Sha256: e6ce906a94b28aec7fbb44b01d5db8569a7063105d9c0adc756e58d060af33c4
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' require 'integration/numeric_validator/spec_helper' describe Country do before(:each) do @country = Country.new(:name => "Italy", :area => "301318") end describe "with area as integer" do before(:each) do # no op in this case end it "is valid" do @country.should be_valid end end describe "with area as integer" do before(:each) do @country.area = 1603 end it "is valid" do @country.should be_valid end end describe "with area as string containing only integers" do before(:each) do @country.area = "301318" end it "is valid" do @country.should be_valid end end describe "with area as string containing a float" do before(:each) do @country.area = "301318.6" end it "IS valid" do @country.should be_valid end end describe "with area as string containing random alphanumeric characters" do before(:each) do @country.area = "area=51" end it "IS NOT valid" do @country.should_not be_valid end end describe "with area as string containing random punctuation characters" do before(:each) do @country.area = "$$ * $?" end it "IS NOT valid" do @country.should_not be_valid end end describe "with unknown area" do before(:each) do @country.area = nil end it "is NOT valid" do @country.should_not be_valid end it "has a meaningful error message on for the property" do @country.valid? @country.errors.on(:area).should == [ 'Please use integers to specify area' ] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-validations-0.10.1 | spec/integration/numeric_validator/integer_only_true_spec.rb |
dm-validations-0.10.0 | spec/integration/numeric_validator/integer_only_true_spec.rb |