summaryrefslogtreecommitdiff
path: root/lib/rb
diff options
context:
space:
mode:
authorJames E. King III <jking@apache.org>2018-06-10 15:55:12 +0000
committerJames E. King III <jking@apache.org>2018-06-10 20:43:45 +0000
commitb5471f63cb4bb8e3b00835a9ca9e48ff76a3bb51 (patch)
tree9d7b878f13c399c80d7ee2e790b225bd2c3aafe4 /lib/rb
parentd2f6f19bb8b79ecdbe705b5144ff64e91ac16f71 (diff)
downloadthrift-b5471f63cb4bb8e3b00835a9ca9e48ff76a3bb51.tar.gz
THRIFT-4289: fix ruby unit test compatibility for 2.4 Fixnum Integer handling
Diffstat (limited to 'lib/rb')
-rw-r--r--lib/rb/spec/struct_spec.rb4
-rw-r--r--lib/rb/spec/types_spec.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/rb/spec/struct_spec.rb b/lib/rb/spec/struct_spec.rb
index b09c7f626..bbd502b62 100644
--- a/lib/rb/spec/struct_spec.rb
+++ b/lib/rb/spec/struct_spec.rb
@@ -227,7 +227,7 @@ describe 'Struct' do
it "should support optional type-checking in Thrift::Struct.new" do
Thrift.type_checking = true
begin
- expect { SpecNamespace::Hello.new(:greeting => 3) }.to raise_error(Thrift::TypeError, "Expected Types::STRING, received Fixnum for field greeting")
+ expect { SpecNamespace::Hello.new(:greeting => 3) }.to raise_error(Thrift::TypeError, /Expected Types::STRING, received (Integer|Fixnum) for field greeting/)
ensure
Thrift.type_checking = false
end
@@ -238,7 +238,7 @@ describe 'Struct' do
Thrift.type_checking = true
begin
hello = SpecNamespace::Hello.new
- expect { hello.greeting = 3 }.to raise_error(Thrift::TypeError, "Expected Types::STRING, received Fixnum for field greeting")
+ expect { hello.greeting = 3 }.to raise_error(Thrift::TypeError, /Expected Types::STRING, received (Integer|Fixnum) for field greeting/)
ensure
Thrift.type_checking = false
end
diff --git a/lib/rb/spec/types_spec.rb b/lib/rb/spec/types_spec.rb
index 364c2a7ec..d595ab563 100644
--- a/lib/rb/spec/types_spec.rb
+++ b/lib/rb/spec/types_spec.rb
@@ -100,9 +100,9 @@ describe Thrift::Types do
end
it "should give the Thrift::TypeError a readable message" do
- msg = "Expected Types::STRING, received Fixnum for field foo"
+ msg = /Expected Types::STRING, received (Integer|Fixnum) for field foo/
expect { Thrift.check_type(3, {:type => Thrift::Types::STRING}, :foo) }.to raise_error(Thrift::TypeError, msg)
- msg = "Expected Types::STRING, received Fixnum for field foo.element"
+ msg = /Expected Types::STRING, received (Integer|Fixnum) for field foo.element/
field = {:type => Thrift::Types::LIST, :element => {:type => Thrift::Types::STRING}}
expect { Thrift.check_type([3], field, :foo) }.to raise_error(Thrift::TypeError, msg)
msg = "Expected Types::I32, received NilClass for field foo.element.key"