Enforce consistent whitespaces around blocks, equal signs, and in parameters in Ruby code
diff --git a/lib/rb/spec/base_protocol_spec.rb b/lib/rb/spec/base_protocol_spec.rb
index cfa7573..b259bb0 100644
--- a/lib/rb/spec/base_protocol_spec.rb
+++ b/lib/rb/spec/base_protocol_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'BaseProtocol' do
-
before(:each) do
@trans = double("MockTransport")
@prot = Thrift::BaseProtocol.new(@trans)
@@ -215,7 +214,7 @@
describe Thrift::BaseProtocolFactory do
it "should raise NotImplementedError" do
# returning nil since Protocol is just an abstract class
- expect {Thrift::BaseProtocolFactory.new.get_protocol(double("MockTransport"))}.to raise_error(NotImplementedError)
+ expect { Thrift::BaseProtocolFactory.new.get_protocol(double("MockTransport")) }.to raise_error(NotImplementedError)
end
it "should provide a reasonable to_s" do
diff --git a/lib/rb/spec/base_transport_spec.rb b/lib/rb/spec/base_transport_spec.rb
index d09ba2b..9182dc1 100644
--- a/lib/rb/spec/base_transport_spec.rb
+++ b/lib/rb/spec/base_transport_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'BaseTransport' do
-
describe Thrift::TransportException do
it "should make type accessible" do
exc = Thrift::TransportException.new(Thrift::TransportException::ALREADY_OPEN, "msg")
@@ -341,10 +340,10 @@
it "should throw an EOFError when there isn't enough data in the buffer" do
@buffer.reset_buffer("")
- expect{@buffer.read(1)}.to raise_error(EOFError)
+ expect{ @buffer.read(1) }.to raise_error(EOFError)
@buffer.reset_buffer("1234")
- expect{@buffer.read(5)}.to raise_error(EOFError)
+ expect{ @buffer.read(5) }.to raise_error(EOFError)
end
end
diff --git a/lib/rb/spec/binary_protocol_spec.rb b/lib/rb/spec/binary_protocol_spec.rb
index 065f5ce..8607290 100644
--- a/lib/rb/spec/binary_protocol_spec.rb
+++ b/lib/rb/spec/binary_protocol_spec.rb
@@ -21,7 +21,6 @@
require File.expand_path("#{File.dirname(__FILE__)}/binary_protocol_spec_shared")
describe 'BinaryProtocol' do
-
it_should_behave_like 'a binary protocol'
def protocol_class
@@ -29,7 +28,6 @@
end
describe Thrift::BinaryProtocol do
-
before(:each) do
@trans = Thrift::MemoryBufferTransport.new
@prot = protocol_class.new(@trans)
diff --git a/lib/rb/spec/binary_protocol_spec_shared.rb b/lib/rb/spec/binary_protocol_spec_shared.rb
index 8de39ef..bd73d1f 100644
--- a/lib/rb/spec/binary_protocol_spec_shared.rb
+++ b/lib/rb/spec/binary_protocol_spec_shared.rb
@@ -185,7 +185,7 @@
it "should write a double" do
# try a random scattering of values, including min/max
- values = [Float::MIN,-1231.15325, -123123.23, -23.23515123, 0, 12351.1325, 523.23, Float::MAX]
+ values = [Float::MIN, -1231.15325, -123123.23, -23.23515123, 0, 12351.1325, 523.23, Float::MAX]
values.each do |f|
@prot.write_double(f)
expect(@trans.read(@trans.available)).to eq([f].pack("G"))
@@ -373,22 +373,22 @@
it "should perform a complete rpc with no args or return" do
srv_test(
- proc {|client| client.send_voidMethod()},
- proc {|client| expect(client.recv_voidMethod).to eq(nil)}
+ proc { |client| client.send_voidMethod() },
+ proc { |client| expect(client.recv_voidMethod).to eq(nil) }
)
end
it "should perform a complete rpc with a primitive return type" do
srv_test(
- proc {|client| client.send_primitiveMethod()},
- proc {|client| expect(client.recv_primitiveMethod).to eq(1)}
+ proc { |client| client.send_primitiveMethod() },
+ proc { |client| expect(client.recv_primitiveMethod).to eq(1) }
)
end
it "should perform a complete rpc with a struct return type" do
srv_test(
- proc {|client| client.send_structMethod()},
- proc {|client|
+ proc { |client| client.send_structMethod() },
+ proc { |client|
result = client.recv_structMethod
result.set_byte_map = nil
result.map_byte_map = nil
diff --git a/lib/rb/spec/client_spec.rb b/lib/rb/spec/client_spec.rb
index f015d66..8650350 100644
--- a/lib/rb/spec/client_spec.rb
+++ b/lib/rb/spec/client_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'Client' do
-
class ClientSpec
include Thrift::Client
end
diff --git a/lib/rb/spec/compact_protocol_spec.rb b/lib/rb/spec/compact_protocol_spec.rb
index e5cb111..944554f 100644
--- a/lib/rb/spec/compact_protocol_spec.rb
+++ b/lib/rb/spec/compact_protocol_spec.rb
@@ -23,9 +23,9 @@
describe Thrift::CompactProtocol do
TESTS = {
:byte => (-127..127).to_a,
- :i16 => (0..14).map {|shift| [1 << shift, -(1 << shift)]}.flatten.sort,
- :i32 => (0..30).map {|shift| [1 << shift, -(1 << shift)]}.flatten.sort,
- :i64 => (0..62).map {|shift| [1 << shift, -(1 << shift)]}.flatten.sort,
+ :i16 => (0..14).map { |shift| [1 << shift, -(1 << shift)] }.flatten.sort,
+ :i32 => (0..30).map { |shift| [1 << shift, -(1 << shift)] }.flatten.sort,
+ :i64 => (0..62).map { |shift| [1 << shift, -(1 << shift)] }.flatten.sort,
:string => ["", "1", "short", "fourteen123456", "fifteen12345678", "unicode characters: \u20AC \u20AD", "1" * 127, "1" * 3000],
:binary => ["", "\001", "\001" * 5, "\001" * 14, "\001" * 15, "\001" * 127, "\001" * 3000],
:double => [0.0, 1.0, -1.0, 1.1, -1.1, 10000000.1, 1.0/0.0, -1.0/0.0],
diff --git a/lib/rb/spec/constants_demo_spec.rb b/lib/rb/spec/constants_demo_spec.rb
index f46582d..555a460 100644
--- a/lib/rb/spec/constants_demo_spec.rb
+++ b/lib/rb/spec/constants_demo_spec.rb
@@ -73,7 +73,7 @@
it 'should have correct set constants' do
expect(ConstantsDemo::GEN_SET).to be_a(Set)
expect(ConstantsDemo::GEN_SET.size).to eq(2)
- expect(ConstantsDemo::GEN_SET.include?(235)).to be true # added twice, but this is a set
+ expect(ConstantsDemo::GEN_SET.include?(235)).to be true # added twice, but this is a set
expect(ConstantsDemo::GEN_SET.include?(53235)).to be true
expect(ConstantsDemo::GUID_SET).to be_a(Set)
diff --git a/lib/rb/spec/exception_spec.rb b/lib/rb/spec/exception_spec.rb
index 379ae69..a5f422d 100644
--- a/lib/rb/spec/exception_spec.rb
+++ b/lib/rb/spec/exception_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'Exception' do
-
describe Thrift::Exception do
it "should have an accessible message" do
e = Thrift::Exception.new("test message")
diff --git a/lib/rb/spec/http_client_spec.rb b/lib/rb/spec/http_client_spec.rb
index 3c02319..b6a8f4c 100644
--- a/lib/rb/spec/http_client_spec.rb
+++ b/lib/rb/spec/http_client_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'Thrift::HTTPClientTransport' do
-
describe Thrift::HTTPClientTransport do
before(:each) do
@client = Thrift::HTTPClientTransport.new("http://my.domain.com/path/to/service?param=value")
@@ -84,7 +83,7 @@
end
end
- @client.flush rescue
+ @client.flush rescue
expect(@client.instance_variable_get(:@outbuf)).to eq(Thrift::Bytes.empty_byte_buffer)
end
@@ -105,7 +104,6 @@
expect { @client.flush }.to raise_error(Thrift::TransportException)
end
-
end
describe 'ssl enabled' do
diff --git a/lib/rb/spec/json_protocol_spec.rb b/lib/rb/spec/json_protocol_spec.rb
index e53fd3e..8da8e0e 100644
--- a/lib/rb/spec/json_protocol_spec.rb
+++ b/lib/rb/spec/json_protocol_spec.rb
@@ -21,7 +21,6 @@
require 'spec_helper'
describe 'JsonProtocol' do
-
describe Thrift::JsonProtocol do
before(:each) do
@trans = Thrift::MemoryBufferTransport.new
@@ -251,8 +250,8 @@
end
it "should get type name for type id" do
- expect {@prot.get_type_name_for_type_id(Thrift::Types::STOP)}.to raise_error(NotImplementedError)
- expect {@prot.get_type_name_for_type_id(Thrift::Types::VOID)}.to raise_error(NotImplementedError)
+ expect { @prot.get_type_name_for_type_id(Thrift::Types::STOP) }.to raise_error(NotImplementedError)
+ expect { @prot.get_type_name_for_type_id(Thrift::Types::VOID) }.to raise_error(NotImplementedError)
expect(@prot.get_type_name_for_type_id(Thrift::Types::BOOL)).to eq("tf")
expect(@prot.get_type_name_for_type_id(Thrift::Types::BYTE)).to eq("i8")
expect(@prot.get_type_name_for_type_id(Thrift::Types::DOUBLE)).to eq("dbl")
@@ -267,7 +266,7 @@
end
it "should get type id for type name" do
- expect {@prot.get_type_id_for_type_name("pp")}.to raise_error(NotImplementedError)
+ expect { @prot.get_type_id_for_type_name("pp") }.to raise_error(NotImplementedError)
expect(@prot.get_type_id_for_type_name("tf")).to eq(Thrift::Types::BOOL)
expect(@prot.get_type_id_for_type_name("i8")).to eq(Thrift::Types::BYTE)
expect(@prot.get_type_id_for_type_name("dbl")).to eq(Thrift::Types::DOUBLE)
@@ -283,7 +282,7 @@
it "should read json syntax char" do
@trans.write('F')
- expect {@prot.read_json_syntax_char('G')}.to raise_error(Thrift::ProtocolException)
+ expect { @prot.read_json_syntax_char('G') }.to raise_error(Thrift::ProtocolException)
@trans.write('H')
@prot.read_json_syntax_char('H')
end
@@ -319,7 +318,7 @@
it "should read json string" do
@trans.write("\"\\P")
- expect {@prot.read_json_string(false)}.to raise_error(Thrift::ProtocolException)
+ expect { @prot.read_json_string(false) }.to raise_error(Thrift::ProtocolException)
@trans.write("\"this is a test string\"")
expect(@prot.read_json_string).to eq("this is a test string")
@@ -356,7 +355,7 @@
it "should read json integer" do
@trans.write("1.45\"\"")
- expect {@prot.read_json_integer}.to raise_error(Thrift::ProtocolException)
+ expect { @prot.read_json_integer }.to raise_error(Thrift::ProtocolException)
@prot.read_string
@trans.write("1453T")
@@ -365,11 +364,11 @@
it "should read json double" do
@trans.write("1.45e3e01\"\"")
- expect {@prot.read_json_double}.to raise_error(Thrift::ProtocolException)
+ expect { @prot.read_json_double }.to raise_error(Thrift::ProtocolException)
@prot.read_string
@trans.write("\"1.453e01\"")
- expect {@prot.read_json_double}.to raise_error(Thrift::ProtocolException)
+ expect { @prot.read_json_double }.to raise_error(Thrift::ProtocolException)
@trans.write("1.453e01\"\"")
expect(@prot.read_json_double).to eq(14.53)
@@ -407,7 +406,7 @@
it "should read_message_begin" do
@trans.write("[2,")
- expect {@prot.read_message_begin}.to raise_error(Thrift::ProtocolException)
+ expect { @prot.read_message_begin }.to raise_error(Thrift::ProtocolException)
@trans.write("[1,\"name\",12,32\"\"")
expect(@prot.read_message_begin).to eq(["name", 12, 32])
diff --git a/lib/rb/spec/namespaced_spec.rb b/lib/rb/spec/namespaced_spec.rb
index 4d6d369..69e4a2a 100644
--- a/lib/rb/spec/namespaced_spec.rb
+++ b/lib/rb/spec/namespaced_spec.rb
@@ -63,5 +63,4 @@
it "extended a service" do
require "extended/extended_service"
end
-
end
diff --git a/lib/rb/spec/nonblocking_server_spec.rb b/lib/rb/spec/nonblocking_server_spec.rb
index cfc60ff..572e0b5 100644
--- a/lib/rb/spec/nonblocking_server_spec.rb
+++ b/lib/rb/spec/nonblocking_server_spec.rb
@@ -21,7 +21,6 @@
require 'timeout'
describe 'NonblockingServer' do
-
class Handler
def initialize
@queue = Queue.new
@@ -77,7 +76,7 @@
@transport.read(sz)
end
- def write(buf,sz=nil)
+ def write(buf, sz = nil)
@transport.write(buf, sz)
end
@@ -167,7 +166,7 @@
break
end
end
- @clients.each { |c,t| t.close and break if c == client } #close the transport
+ @clients.each { |c, t| t.close and break if c == client } # close the transport
rescue => e
raise e unless @catch_exceptions
end
diff --git a/lib/rb/spec/processor_spec.rb b/lib/rb/spec/processor_spec.rb
index d30553f..5774df7 100644
--- a/lib/rb/spec/processor_spec.rb
+++ b/lib/rb/spec/processor_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'Processor' do
-
class ProcessorSpec
include Thrift::Processor
end
diff --git a/lib/rb/spec/serializer_spec.rb b/lib/rb/spec/serializer_spec.rb
index 2a7dc6d..b8afdc5 100644
--- a/lib/rb/spec/serializer_spec.rb
+++ b/lib/rb/spec/serializer_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'Serializer' do
-
describe Thrift::Serializer do
it "should serialize structs to binary by default" do
serializer = Thrift::Serializer.new(Thrift::BinaryProtocolAcceleratedFactory.new)
diff --git a/lib/rb/spec/server_socket_spec.rb b/lib/rb/spec/server_socket_spec.rb
index 56b3bac..4fa305d 100644
--- a/lib/rb/spec/server_socket_spec.rb
+++ b/lib/rb/spec/server_socket_spec.rb
@@ -21,7 +21,6 @@
require File.expand_path("#{File.dirname(__FILE__)}/socket_spec_shared")
describe 'Thrift::ServerSocket' do
-
describe Thrift::ServerSocket do
before(:each) do
@socket = Thrift::ServerSocket.new(1234)
diff --git a/lib/rb/spec/server_spec.rb b/lib/rb/spec/server_spec.rb
index 47204aa..c403833 100644
--- a/lib/rb/spec/server_spec.rb
+++ b/lib/rb/spec/server_spec.rb
@@ -19,7 +19,6 @@
require 'spec_helper'
describe 'Server' do
-
describe Thrift::BaseServer do
before(:each) do
@processor = double("Processor")
@@ -36,7 +35,7 @@
end
it "should not serve" do
- expect { @server.serve()}.to raise_error(NotImplementedError)
+ expect { @server.serve() }.to raise_error(NotImplementedError)
end
it "should provide a reasonable to_s" do
diff --git a/lib/rb/spec/socket_spec.rb b/lib/rb/spec/socket_spec.rb
index 202c745..b8b2045 100644
--- a/lib/rb/spec/socket_spec.rb
+++ b/lib/rb/spec/socket_spec.rb
@@ -21,7 +21,6 @@
require File.expand_path("#{File.dirname(__FILE__)}/socket_spec_shared")
describe 'Socket' do
-
describe Thrift::Socket do
before(:each) do
@socket = Thrift::Socket.new
diff --git a/lib/rb/spec/spec_helper.rb b/lib/rb/spec/spec_helper.rb
index 7c16507..24707aa 100644
--- a/lib/rb/spec/spec_helper.rb
+++ b/lib/rb/spec/spec_helper.rb
@@ -55,7 +55,7 @@
module Fixtures
COMPACT_PROTOCOL_TEST_STRUCT = Thrift::Test::COMPACT_TEST.dup
- COMPACT_PROTOCOL_TEST_STRUCT.a_binary = [0,1,2,3,4,5,6,7,8].pack('c*')
+ COMPACT_PROTOCOL_TEST_STRUCT.a_binary = [0, 1, 2, 3, 4, 5, 6, 7, 8].pack('c*')
COMPACT_PROTOCOL_TEST_STRUCT.set_byte_map = nil
COMPACT_PROTOCOL_TEST_STRUCT.map_byte_map = nil
end
diff --git a/lib/rb/spec/ssl_server_socket_spec.rb b/lib/rb/spec/ssl_server_socket_spec.rb
index 20cfdf4..c228de0 100644
--- a/lib/rb/spec/ssl_server_socket_spec.rb
+++ b/lib/rb/spec/ssl_server_socket_spec.rb
@@ -21,7 +21,6 @@
require File.expand_path("#{File.dirname(__FILE__)}/socket_spec_shared")
describe 'SSLServerSocket' do
-
describe Thrift::SSLServerSocket do
before(:each) do
@socket = Thrift::SSLServerSocket.new(1234)
diff --git a/lib/rb/spec/ssl_socket_spec.rb b/lib/rb/spec/ssl_socket_spec.rb
index eb68bcf..1bff813 100644
--- a/lib/rb/spec/ssl_socket_spec.rb
+++ b/lib/rb/spec/ssl_socket_spec.rb
@@ -21,7 +21,6 @@
require File.expand_path("#{File.dirname(__FILE__)}/socket_spec_shared")
describe 'SSLSocket' do
-
describe Thrift::SSLSocket do
before(:each) do
@context = OpenSSL::SSL::SSLContext.new
diff --git a/lib/rb/spec/struct_nested_containers_spec.rb b/lib/rb/spec/struct_nested_containers_spec.rb
index d063569..552c66a 100644
--- a/lib/rb/spec/struct_nested_containers_spec.rb
+++ b/lib/rb/spec/struct_nested_containers_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'StructNestedContainers' do
-
def with_type_checking
saved_type_checking, Thrift.type_checking = Thrift.type_checking, true
begin
@@ -166,7 +165,7 @@
with_type_checking do
a, b = SpecNamespace::NestedMapInMapKey.new, SpecNamespace::NestedMapInMapKey.new
[a, b].each do |thrift_struct|
- thrift_struct.value = { { 1 => 2, 3 => 4} => 1, {2 => 3, 4 => 5} => 2 }
+ thrift_struct.value = { { 1 => 2, 3 => 4} => 1, {2 => 3, 4 => 5} => 2 }
thrift_struct.validate
end
expect(a).to eq(b)
diff --git a/lib/rb/spec/struct_spec.rb b/lib/rb/spec/struct_spec.rb
index 36c738e..800b21a 100644
--- a/lib/rb/spec/struct_spec.rb
+++ b/lib/rb/spec/struct_spec.rb
@@ -20,11 +20,10 @@
require 'spec_helper'
describe 'Struct' do
-
describe Thrift::Struct do
it "should iterate over all fields properly" do
fields = {}
- SpecNamespace::Foo.new.each_field { |fid,field_info| fields[fid] = field_info }
+ SpecNamespace::Foo.new.each_field { |fid, field_info| fields[fid] = field_info }
expect(fields).to eq(SpecNamespace::Foo::FIELDS)
end
@@ -51,10 +50,10 @@
begin
struct = SpecNamespace::Foo.new
struct.ints << 17
- expect(SpecNamespace::Foo.new.ints).to eq([1,2,2,3])
+ expect(SpecNamespace::Foo.new.ints).to eq([1, 2, 2, 3])
ensure
# ensure no leakage to other tests
- SpecNamespace::Foo::FIELDS[4][:default] = [1,2,2,3]
+ SpecNamespace::Foo::FIELDS[4][:default] = [1, 2, 2, 3]
end
end
@@ -209,7 +208,7 @@
end
it "should write itself to the wire" do
- prot = Thrift::BaseProtocol.new(double("transport")) #mock("Protocol")
+ prot = Thrift::BaseProtocol.new(double("transport")) # mock("Protocol")
expect(prot).to receive(:write_struct_begin).with("SpecNamespace::Foo")
expect(prot).to receive(:write_struct_begin).with("SpecNamespace::Hello")
expect(prot).to receive(:write_struct_end).twice
@@ -287,9 +286,9 @@
prot = Thrift::BaseProtocol.new(double("trans"))
expect(prot).to receive(:write_struct_begin).with("SpecNamespace::Xception")
expect(prot).to receive(:write_struct_end)
- expect(prot).to receive(:write_field_begin).with('message', Thrift::Types::STRING, 1)#, "something happened")
+ expect(prot).to receive(:write_field_begin).with('message', Thrift::Types::STRING, 1)
expect(prot).to receive(:write_string).with("something happened")
- expect(prot).to receive(:write_field_begin).with('code', Thrift::Types::I32, 2)#, 1)
+ expect(prot).to receive(:write_field_begin).with('code', Thrift::Types::I32, 2)
expect(prot).to receive(:write_i32).with(1)
expect(prot).to receive(:write_field_stop)
expect(prot).to receive(:write_field_end).twice
diff --git a/lib/rb/spec/thin_http_server_spec.rb b/lib/rb/spec/thin_http_server_spec.rb
index 6f8f8e2..9046a00 100644
--- a/lib/rb/spec/thin_http_server_spec.rb
+++ b/lib/rb/spec/thin_http_server_spec.rb
@@ -22,13 +22,10 @@
require 'thrift/server/thin_http_server'
describe Thrift::ThinHTTPServer do
-
let(:processor) { double('processor') }
describe "#initialize" do
-
context "when using the defaults" do
-
it "binds to port 80, with host 0.0.0.0, a path of '/'" do
expect(Thin::Server).to receive(:new).with('0.0.0.0', 80, an_instance_of(Rack::Builder))
Thrift::ThinHTTPServer.new(processor)
@@ -43,11 +40,9 @@
expect(Thrift::BinaryProtocolFactory).to receive(:new)
Thrift::ThinHTTPServer.new(processor)
end
-
end
context "when using the options" do
-
it 'accepts :ip, :port, :path' do
ip = "192.168.0.1"
port = 3000
@@ -64,13 +59,10 @@
Thrift::ThinHTTPServer.new(processor,
:protocol_factory => Thrift::JsonProtocolFactory.new)
end
-
end
-
end
describe "#serve" do
-
it 'starts the Thin server' do
underlying_thin_server = double('thin server', :start => true)
allow(Thin::Server).to receive(:new).and_return(underlying_thin_server)
@@ -81,7 +73,6 @@
thin_thrift_server.serve
end
end
-
end
describe Thrift::ThinHTTPServer::RackApplication do
@@ -95,7 +86,6 @@
end
context "404 response" do
-
it 'receives a non-POST' do
header('Content-Type', "application/x-thrift")
get "/"
@@ -107,11 +97,9 @@
post "/"
expect(last_response.status).to eq 404
end
-
end
context "200 response" do
-
before do
allow(protocol_factory).to receive(:get_protocol)
allow(processor).to receive(:process)
@@ -134,7 +122,5 @@
post "/"
expect(last_response.ok?).to be true
end
-
end
-
end
diff --git a/lib/rb/spec/types_spec.rb b/lib/rb/spec/types_spec.rb
index a385367..a0ef755 100644
--- a/lib/rb/spec/types_spec.rb
+++ b/lib/rb/spec/types_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe Thrift::Types do
-
before(:each) do
Thrift.type_checking = true
end
@@ -39,33 +38,33 @@
it "should check types properly" do
# lambda { Thrift.check_type(nil, Thrift::Types::STOP) }.should raise_error(Thrift::TypeError)
- expect { Thrift.check_type(3, {:type => Thrift::Types::STOP}, :foo) }.to raise_error(Thrift::TypeError)
- expect { Thrift.check_type(nil, {:type => Thrift::Types::VOID}, :foo) }.not_to raise_error
- expect { Thrift.check_type(3, {:type => Thrift::Types::VOID}, :foo) }.to raise_error(Thrift::TypeError)
- expect { Thrift.check_type(true, {:type => Thrift::Types::BOOL}, :foo) }.not_to raise_error
- expect { Thrift.check_type(3, {:type => Thrift::Types::BOOL}, :foo) }.to raise_error(Thrift::TypeError)
- expect { Thrift.check_type(42, {:type => Thrift::Types::BYTE}, :foo) }.not_to raise_error
- expect { Thrift.check_type(42, {:type => Thrift::Types::I16}, :foo) }.not_to raise_error
- expect { Thrift.check_type(42, {:type => Thrift::Types::I32}, :foo) }.not_to raise_error
- expect { Thrift.check_type(42, {:type => Thrift::Types::I64}, :foo) }.not_to raise_error
- expect { Thrift.check_type(3.14, {:type => Thrift::Types::I32}, :foo) }.to raise_error(Thrift::TypeError)
- expect { Thrift.check_type(3.14, {:type => Thrift::Types::DOUBLE}, :foo) }.not_to raise_error
- expect { Thrift.check_type(3, {:type => Thrift::Types::DOUBLE}, :foo) }.to raise_error(Thrift::TypeError)
- expect { Thrift.check_type("3", {:type => Thrift::Types::STRING}, :foo) }.not_to raise_error
- expect { Thrift.check_type(3, {:type => Thrift::Types::STRING}, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type(3, {:type => Thrift::Types::STOP}, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type(nil, {:type => Thrift::Types::VOID}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(3, {:type => Thrift::Types::VOID}, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type(true, {:type => Thrift::Types::BOOL}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(3, {:type => Thrift::Types::BOOL}, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type(42, {:type => Thrift::Types::BYTE}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(42, {:type => Thrift::Types::I16}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(42, {:type => Thrift::Types::I32}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(42, {:type => Thrift::Types::I64}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(3.14, {:type => Thrift::Types::I32}, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type(3.14, {:type => Thrift::Types::DOUBLE}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(3, {:type => Thrift::Types::DOUBLE}, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type("3", {:type => Thrift::Types::STRING}, :foo) }.not_to raise_error
+ expect { Thrift.check_type(3, {:type => Thrift::Types::STRING}, :foo) }.to raise_error(Thrift::TypeError)
hello = SpecNamespace::Hello.new
- expect { Thrift.check_type(hello, {:type => Thrift::Types::STRUCT, :class => SpecNamespace::Hello}, :foo) }.not_to raise_error
- expect { Thrift.check_type("foo", {:type => Thrift::Types::STRUCT}, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type(hello, {:type => Thrift::Types::STRUCT, :class => SpecNamespace::Hello}, :foo) }.not_to raise_error
+ expect { Thrift.check_type("foo", {:type => Thrift::Types::STRUCT}, :foo) }.to raise_error(Thrift::TypeError)
field = {:type => Thrift::Types::MAP, :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRING}}
- expect { Thrift.check_type({1 => "one"}, field, :foo) }.not_to raise_error
- expect { Thrift.check_type([1], field, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type({1 => "one"}, field, :foo) }.not_to raise_error
+ expect { Thrift.check_type([1], field, :foo) }.to raise_error(Thrift::TypeError)
field = {:type => Thrift::Types::LIST, :element => {:type => Thrift::Types::I32}}
- expect { Thrift.check_type([1], field, :foo) }.not_to raise_error
- expect { Thrift.check_type({:foo => 1}, field, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type([1], field, :foo) }.not_to raise_error
+ expect { Thrift.check_type({:foo => 1}, field, :foo) }.to raise_error(Thrift::TypeError)
field = {:type => Thrift::Types::SET, :element => {:type => Thrift::Types::I32}}
- expect { Thrift.check_type(Set.new([1,2]), field, :foo) }.not_to raise_error
- expect { Thrift.check_type([1,2], field, :foo) }.to raise_error(Thrift::TypeError)
- expect { Thrift.check_type({:foo => true}, field, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type(Set.new([1, 2]), field, :foo) }.not_to raise_error
+ expect { Thrift.check_type([1, 2], field, :foo) }.to raise_error(Thrift::TypeError)
+ expect { Thrift.check_type({:foo => true}, field, :foo) }.to raise_error(Thrift::TypeError)
end
it "should error out if nil is passed and skip_types is false" do
diff --git a/lib/rb/spec/union_spec.rb b/lib/rb/spec/union_spec.rb
index f38093d..e45aa42 100644
--- a/lib/rb/spec/union_spec.rb
+++ b/lib/rb/spec/union_spec.rb
@@ -20,7 +20,6 @@
require 'spec_helper'
describe 'Union' do
-
describe Thrift::Union do
it "should return nil value in unset union" do
union = SpecNamespace::My_union.new
@@ -194,7 +193,7 @@
end
it "should not throw an error when inspected and unset" do
- expect{SpecNamespace::TestUnion.new().inspect}.not_to raise_error
+ expect{ SpecNamespace::TestUnion.new().inspect }.not_to raise_error
end
it "should print enum value name when inspected" do
diff --git a/lib/rb/spec/unix_socket_spec.rb b/lib/rb/spec/unix_socket_spec.rb
index 7f878a1..437ca83 100644
--- a/lib/rb/spec/unix_socket_spec.rb
+++ b/lib/rb/spec/unix_socket_spec.rb
@@ -21,7 +21,6 @@
require File.expand_path("#{File.dirname(__FILE__)}/socket_spec_shared")
describe 'UNIXSocket' do
-
describe Thrift::UNIXSocket do
before(:each) do
@path = '/tmp/thrift_spec_socket'
diff --git a/lib/rb/spec/uuid_validation_spec.rb b/lib/rb/spec/uuid_validation_spec.rb
index c95d408..3f46f7e 100644
--- a/lib/rb/spec/uuid_validation_spec.rb
+++ b/lib/rb/spec/uuid_validation_spec.rb
@@ -186,7 +186,7 @@
@trans = Thrift::MemoryBufferTransport.new
@prot = protocol_class.new(@trans)
- @prot.write_message_begin('testMessage', Thrift::MessageTypes::CALL, 0)
+ @prot.write_message_begin('testMessage', Thrift::MessageTypes::CALL, 0)
@prot.write_i32(42)
@prot.write_uuid('550e8400-e29b-41d4-a716-446655440000')
@prot.write_string('test')