THRIFT-4289: fix ruby unit test compatibility for 2.4 Fixnum Integer handling
diff --git a/lib/rb/spec/struct_spec.rb b/lib/rb/spec/struct_spec.rb
index b09c7f6..bbd502b 100644
--- a/lib/rb/spec/struct_spec.rb
+++ b/lib/rb/spec/struct_spec.rb
@@ -227,7 +227,7 @@
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 @@
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 364c2a7..d595ab5 100644
--- a/lib/rb/spec/types_spec.rb
+++ b/lib/rb/spec/types_spec.rb
@@ -100,9 +100,9 @@
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"