diff --git a/lib/oga/xpath/evaluator.rb b/lib/oga/xpath/evaluator.rb index 33a7aa2..28b8204 100644 --- a/lib/oga/xpath/evaluator.rb +++ b/lib/oga/xpath/evaluator.rb @@ -967,7 +967,7 @@ module Oga # @return [Float] # def on_int(ast_node, context) - return ast_node.children[0] + return ast_node.children[0].to_f end ## diff --git a/spec/oga/xpath/evaluator/calls/string_spec.rb b/spec/oga/xpath/evaluator/calls/string_spec.rb index c09e310..b45b543 100644 --- a/spec/oga/xpath/evaluator/calls/string_spec.rb +++ b/spec/oga/xpath/evaluator/calls/string_spec.rb @@ -37,7 +37,7 @@ describe Oga::XPath::Evaluator do end example 'convert an integer to a string' do - @evaluator.evaluate('string(10)').should == '10' + @evaluator.evaluate('string(10)').should == '10.0' end example 'convert a float to a string' do diff --git a/spec/oga/xpath/evaluator/types/int_spec.rb b/spec/oga/xpath/evaluator/types/int_spec.rb index e2f01ad..7321f2f 100644 --- a/spec/oga/xpath/evaluator/types/int_spec.rb +++ b/spec/oga/xpath/evaluator/types/int_spec.rb @@ -12,8 +12,8 @@ describe Oga::XPath::Evaluator do @number.should == 1 end - example 'return integers as Fixnums' do - @number.is_a?(Fixnum).should == true + example 'return integers as floats' do + @number.is_a?(Float).should == true end end end