Sha256: 777061c4b0d8ffb8ba2fe0a23353fa709a95e35c4d82eb2b0cf9dee763cc51da
Contents?: true
Size: 588 Bytes
Versions: 3
Compression:
Stored size: 588 Bytes
Contents
require 'spec_helper' describe RestModel::Serialization::Integer do it "adds leading zeros from options while desserializing" do subject.class.desserialize('1200', padding_zeros: 12).should == "000000001200" end it "converts to integer" do subject.class.serialize('1200').should == 1200 end it "converts negative number to negative integer" do subject.class.serialize('-1').should == -1 end context "when an invalid value is serialized" do it "raises an error" do expect {subject.class.serialize("not an integer")}.to raise_error end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rest_model-0.3.1 | spec/unit/serialization/integer_spec.rb |
rest_model-0.3.0 | spec/unit/serialization/integer_spec.rb |
rest_model-0.2.3 | spec/unit/serialization/integer_spec.rb |