@@ -25,7 +25,7 @@ module Protocol
2525 let :buffer do
2626 described_class . new
2727 end
28-
28+
2929 describe '#read_unsigned_byte' do
3030 let :buffer do
3131 described_class . new ( "\xab " )
@@ -79,62 +79,62 @@ module Protocol
7979 end
8080
8181 it 'decodes a decimal to a BigDecimal' do
82- buffer . read_decimal . should == BigDecimal . new ( '1042342234234.123423435647768234' )
82+ buffer . read_decimal . should == BigDecimal ( '1042342234234.123423435647768234' )
8383 end
8484
8585 it 'decodes a negative decimal' do
8686 buffer = described_class . new ( "\x00 \x00 \x00 \x12 \xF2 \xD8 \x02 \xB6 R\x7F \x99 \xEE \x98 #\x99 \xA9 V" )
87- buffer . read_decimal . should == BigDecimal . new ( '-1042342234234.123423435647768234' )
87+ buffer . read_decimal . should == BigDecimal ( '-1042342234234.123423435647768234' )
8888 end
8989
9090 it 'decodes a positive decimal with only fractions' do
9191 buffer = described_class . new ( "\x00 \x00 \x00 \x13 *\xF8 \xC4 \xDF \xEB ]o" )
92- buffer . read_decimal . should == BigDecimal . new ( '0.0012095473475870063' )
92+ buffer . read_decimal . should == BigDecimal ( '0.0012095473475870063' )
9393 end
9494
9595 it 'decodes a negative decimal with only fractions' do
9696 buffer = described_class . new ( "\x00 \x00 \x00 \x13 \xD5 \a ;\x20 \x14 \xA2 \x91 " )
97- buffer . read_decimal . should == BigDecimal . new ( '-0.0012095473475870063' )
97+ buffer . read_decimal . should == BigDecimal ( '-0.0012095473475870063' )
9898 end
9999
100100 it 'decodes a small negative decimal' do
101101 buffer = described_class . new ( "\x00 \x00 \x00 \x12 \x91 z\xE1 \xAF \x06 c\x5A " )
102- buffer . read_decimal . should == BigDecimal . new ( '-0.031108612692221094' )
102+ buffer . read_decimal . should == BigDecimal ( '-0.031108612692221094' )
103103 end
104104
105105 it 'decodes a decimal with negative scale' do
106106 buffer = described_class . new ( "\xff \xff \xff \xfa \x0a " )
107- buffer . read_decimal . should == BigDecimal . new ( '10000000' )
107+ buffer . read_decimal . should == BigDecimal ( '10000000' )
108108 end
109109
110110 it 'decodes a negative decimal with negative scale' do
111111 buffer = described_class . new ( "\xff \xff \xff \xf9 \xfd " )
112- buffer . read_decimal . should == BigDecimal . new ( '-30000000' )
112+ buffer . read_decimal . should == BigDecimal ( '-30000000' )
113113 end
114114
115115 it 'decodes a decimal with zero scale' do
116116 buffer = described_class . new ( "\x00 \x00 \x00 \x00 \x0a " )
117- buffer . read_decimal . should == BigDecimal . new ( '10' )
117+ buffer . read_decimal . should == BigDecimal ( '10' )
118118 end
119119
120120 it 'decodes a negative decimal with zero scale' do
121121 buffer = described_class . new ( "\x00 \x00 \x00 \x00 \xfe " )
122- buffer . read_decimal . should == BigDecimal . new ( '-2' )
122+ buffer . read_decimal . should == BigDecimal ( '-2' )
123123 end
124124
125125 it 'decodes zero decimal with zero scale' do
126126 buffer = described_class . new ( "\x00 \x00 \x00 \x00 \x00 " )
127- buffer . read_decimal . should == BigDecimal . new ( '0' )
127+ buffer . read_decimal . should == BigDecimal ( '0' )
128128 end
129129
130130 it 'decodes zero decimal with negative scale' do
131131 buffer = described_class . new ( "\xff \xff \xff \xf9 \x00 " )
132- buffer . read_decimal . should == BigDecimal . new ( '0' )
132+ buffer . read_decimal . should == BigDecimal ( '0' )
133133 end
134134
135135 it 'decodes zero decimal with positive scale' do
136136 buffer = described_class . new ( "\x00 \x00 \x00 \x05 \x00 " )
137- buffer . read_decimal . should == BigDecimal . new ( '0' )
137+ buffer . read_decimal . should == BigDecimal ( '0' )
138138 end
139139
140140 it 'consumes the bytes' do
@@ -326,7 +326,7 @@ module Protocol
326326 it 'decodes a UUID as a Cassandra::Uuid' do
327327 buffer . read_uuid . should == Uuid . new ( 'a4a70900-24e1-11df-8924-001ff3591711' )
328328 end
329-
329+
330330 it 'decodes a UUID as a Cassandra::TimeUuid' do
331331 uuid = buffer . read_uuid ( TimeUuid )
332332 uuid . should == TimeUuid . new ( 'a4a70900-24e1-11df-8924-001ff3591711' )
@@ -337,7 +337,7 @@ module Protocol
337337 buffer . read_uuid
338338 buffer . should be_empty
339339 end
340-
340+
341341 it 'raises an error when there a not enough bytes in the buffer' do
342342 b = described_class . new ( buffer . discard ( 2 ) . read ( 5 ) )
343343 expect { b . read_uuid } . to raise_error ( Errors ::DecodingError )
@@ -910,38 +910,38 @@ module Protocol
910910
911911 describe '#append_decimal' do
912912 it 'encodes a BigDecimal as a decimal' do
913- buffer . append_decimal ( BigDecimal . new ( '1042342234234.123423435647768234' ) )
913+ buffer . append_decimal ( BigDecimal ( '1042342234234.123423435647768234' ) )
914914 buffer . should eql_bytes ( "\x00 \x00 \x00 \x12 \r '\xFD I\xAD \x80 f\x11 g\xDC fV\xAA " )
915915 end
916916
917917 it 'encodes a 0.0 BigDecimal' do
918- buffer . append_decimal ( BigDecimal . new ( '0.0' ) )
918+ buffer . append_decimal ( BigDecimal ( '0.0' ) )
919919 buffer . should eql_bytes ( "\x00 \x00 \x00 \x01 \x00 " )
920920 end
921921
922922 it 'encodes a BigDecimal ending in .0' do
923- buffer . append_decimal ( BigDecimal . new ( '1042342234234.0' ) )
923+ buffer . append_decimal ( BigDecimal ( '1042342234234.0' ) )
924924 buffer . should eql_bytes ( "\x00 \x00 \x00 \x01 \t z\xE4 b\xD4 \xC4 " )
925925 end
926926
927927 it 'encodes a BigDecimal ending with 00.0' do
928- buffer . append_decimal ( BigDecimal . new ( '12000.0' ) )
928+ buffer . append_decimal ( BigDecimal ( '12000.0' ) )
929929 buffer . should eql_bytes ( "\x00 \x00 \x00 \x01 \x01 \xD4 \xC0 " )
930930 end
931931
932932 it 'encodes a BigDecimal with zero padding when sign bit is on' do
933- buffer . append_decimal ( BigDecimal . new ( '25.0' ) )
933+ buffer . append_decimal ( BigDecimal ( '25.0' ) )
934934 buffer . should eql_bytes ( "\x00 \x00 \x00 \x01 \x00 \xFA " )
935935 end
936936
937937 it 'appends to the buffer' do
938938 buffer << "\x99 "
939- buffer . append_decimal ( BigDecimal . new ( '1042342234234.123423435647768234' ) )
939+ buffer . append_decimal ( BigDecimal ( '1042342234234.123423435647768234' ) )
940940 buffer . read ( 1 ) . should eql_bytes ( "\x99 " )
941941 end
942942
943943 it 'returns the buffer' do
944- result = buffer . append_decimal ( BigDecimal . new ( '3.14' ) )
944+ result = buffer . append_decimal ( BigDecimal ( '3.14' ) )
945945 result . should equal ( buffer )
946946 end
947947 end
0 commit comments