-
-
Save shingara/daab3c0f31340c2f6460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec' | |
require 'virtus' | |
class MyObject | |
include Virtus | |
attribute :int, Integer | |
attribute :float, Float | |
end | |
o = MyObject.new( | |
:int => "334490140000101135", | |
:float => "334490140000101135" | |
) | |
describe "Coercion" do | |
it 'should have good conversion in int' do | |
o.int.should == 334490140000101135 | |
end | |
it 'should have good conversion in float' do | |
o.float.should == 334490140000101135.0 | |
end | |
end | |
# $ rspec virtus_coercion_bug.rb [11:59:47] | |
# F. | |
# Failures: | |
# 1) Coercion should have good conversion in int | |
# Failure/Error: o.int.should == 334490140000101135 | |
# expected: 334490140000101135 | |
# got: 334490140000101120 (using ==) | |
# # ./virtus_coercion_bug.rb:17:in `block (2 levels) in <top (required)>' | |
# Finished in 0.00043 seconds | |
# 2 examples, 1 failure | |
# Failed examples: | |
# | |
# rspec ./virtus_coercion_bug.rb:16 # Coercion should have good conversion in int |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment