diff options
author | Masahiro Saito <camelmasa@gmail.com> | 2017-01-06 21:45:16 +0900 |
---|---|---|
committer | Daniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org> | 2017-01-06 07:45:16 -0500 |
commit | 87582b589fe04a9f0433478997d42aa8fa798144 (patch) | |
tree | 248c1f76d3bb295a691e39d8b35bb00f186c67c1 /spec/hashie | |
parent | 199d816bc0865d4276a1b6db669ef9f3a2fedfc1 (diff) | |
download | hashie-87582b589fe04a9f0433478997d42aa8fa798144.tar.gz |
Support Ruby 2.4.0 (#389)
Diffstat (limited to 'spec/hashie')
-rw-r--r-- | spec/hashie/extensions/coercion_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/hashie/extensions/coercion_spec.rb b/spec/hashie/extensions/coercion_spec.rb index d8af161..7d70ed4 100644 --- a/spec/hashie/extensions/coercion_spec.rb +++ b/spec/hashie/extensions/coercion_spec.rb @@ -558,8 +558,14 @@ describe Hashie::Extensions::Coercion do end it 'raises a CoercionError when coercion is not possible' do - subject.coerce_value Fixnum, Symbol - expect { instance[:hi] = 1 }.to raise_error(Hashie::CoercionError, /Cannot coerce property :hi from Fixnum to Symbol/) + type = if Hashie::Extensions::RubyVersion.new(RUBY_VERSION) >= Hashie::Extensions::RubyVersion.new('2.4.0') + Integer + else + Fixnum + end + + subject.coerce_value type, Symbol + expect { instance[:hi] = 1 }.to raise_error(Hashie::CoercionError, /Cannot coerce property :hi from #{type} to Symbol/) end it 'coerces Integer to String' do |