THRIFT-4342: update ruby tests to use rspec 3, updated all dependencies for ruby
Client: rb
diff --git a/lib/rb/spec/serializer_spec.rb b/lib/rb/spec/serializer_spec.rb
index 599b454..2a7dc6d 100644
--- a/lib/rb/spec/serializer_spec.rb
+++ b/lib/rb/spec/serializer_spec.rb
@@ -25,19 +25,19 @@
it "should serialize structs to binary by default" do
serializer = Thrift::Serializer.new(Thrift::BinaryProtocolAcceleratedFactory.new)
data = serializer.serialize(SpecNamespace::Hello.new(:greeting => "'Ello guv'nor!"))
- data.should == "\x0B\x00\x01\x00\x00\x00\x0E'Ello guv'nor!\x00"
+ expect(data).to eq("\x0B\x00\x01\x00\x00\x00\x0E'Ello guv'nor!\x00")
end
it "should serialize structs to the given protocol" do
- protocol = Thrift::BaseProtocol.new(mock("transport"))
- protocol.should_receive(:write_struct_begin).with("SpecNamespace::Hello")
- protocol.should_receive(:write_field_begin).with("greeting", Thrift::Types::STRING, 1)
- protocol.should_receive(:write_string).with("Good day")
- protocol.should_receive(:write_field_end)
- protocol.should_receive(:write_field_stop)
- protocol.should_receive(:write_struct_end)
- protocol_factory = mock("ProtocolFactory")
- protocol_factory.stub!(:get_protocol).and_return(protocol)
+ protocol = Thrift::BaseProtocol.new(double("transport"))
+ expect(protocol).to receive(:write_struct_begin).with("SpecNamespace::Hello")
+ expect(protocol).to receive(:write_field_begin).with("greeting", Thrift::Types::STRING, 1)
+ expect(protocol).to receive(:write_string).with("Good day")
+ expect(protocol).to receive(:write_field_end)
+ expect(protocol).to receive(:write_field_stop)
+ expect(protocol).to receive(:write_struct_end)
+ protocol_factory = double("ProtocolFactory")
+ allow(protocol_factory).to receive(:get_protocol).and_return(protocol)
serializer = Thrift::Serializer.new(protocol_factory)
serializer.serialize(SpecNamespace::Hello.new(:greeting => "Good day"))
end
@@ -47,21 +47,21 @@
it "should deserialize structs from binary by default" do
deserializer = Thrift::Deserializer.new
data = "\x0B\x00\x01\x00\x00\x00\x0E'Ello guv'nor!\x00"
- deserializer.deserialize(SpecNamespace::Hello.new, data).should == SpecNamespace::Hello.new(:greeting => "'Ello guv'nor!")
+ expect(deserializer.deserialize(SpecNamespace::Hello.new, data)).to eq(SpecNamespace::Hello.new(:greeting => "'Ello guv'nor!"))
end
it "should deserialize structs from the given protocol" do
- protocol = Thrift::BaseProtocol.new(mock("transport"))
- protocol.should_receive(:read_struct_begin).and_return("SpecNamespace::Hello")
- protocol.should_receive(:read_field_begin).and_return(["greeting", Thrift::Types::STRING, 1],
+ protocol = Thrift::BaseProtocol.new(double("transport"))
+ expect(protocol).to receive(:read_struct_begin).and_return("SpecNamespace::Hello")
+ expect(protocol).to receive(:read_field_begin).and_return(["greeting", Thrift::Types::STRING, 1],
[nil, Thrift::Types::STOP, 0])
- protocol.should_receive(:read_string).and_return("Good day")
- protocol.should_receive(:read_field_end)
- protocol.should_receive(:read_struct_end)
- protocol_factory = mock("ProtocolFactory")
- protocol_factory.stub!(:get_protocol).and_return(protocol)
+ expect(protocol).to receive(:read_string).and_return("Good day")
+ expect(protocol).to receive(:read_field_end)
+ expect(protocol).to receive(:read_struct_end)
+ protocol_factory = double("ProtocolFactory")
+ allow(protocol_factory).to receive(:get_protocol).and_return(protocol)
deserializer = Thrift::Deserializer.new(protocol_factory)
- deserializer.deserialize(SpecNamespace::Hello.new, "").should == SpecNamespace::Hello.new(:greeting => "Good day")
+ expect(deserializer.deserialize(SpecNamespace::Hello.new, "")).to eq(SpecNamespace::Hello.new(:greeting => "Good day"))
end
end
end