websocket 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +16 -0
  3. data/.rubocop.yml +18 -3
  4. data/.travis.yml +6 -8
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile +10 -0
  7. data/README.md +2 -2
  8. data/Rakefile +1 -1
  9. data/lib/websocket.rb +1 -0
  10. data/lib/websocket/frame/base.rb +1 -7
  11. data/lib/websocket/frame/handler/base.rb +2 -2
  12. data/lib/websocket/frame/handler/handler03.rb +2 -1
  13. data/lib/websocket/frame/handler/handler75.rb +1 -1
  14. data/lib/websocket/handshake/base.rb +1 -7
  15. data/lib/websocket/handshake/handler/client.rb +9 -0
  16. data/lib/websocket/handshake/handler/client04.rb +6 -7
  17. data/lib/websocket/handshake/handler/client75.rb +6 -7
  18. data/lib/websocket/handshake/handler/client76.rb +2 -7
  19. data/lib/websocket/handshake/handler/server75.rb +13 -5
  20. data/lib/websocket/handshake/handler/server76.rb +9 -17
  21. data/lib/websocket/handshake/server.rb +1 -1
  22. data/lib/websocket/nice_inspect.rb +10 -0
  23. data/lib/websocket/version.rb +1 -1
  24. data/spec/frame/incoming_03_spec.rb +3 -2
  25. data/spec/frame/incoming_04_spec.rb +3 -2
  26. data/spec/frame/incoming_05_spec.rb +3 -2
  27. data/spec/frame/incoming_07_spec.rb +3 -2
  28. data/spec/frame/incoming_75_spec.rb +3 -2
  29. data/spec/frame/incoming_common_spec.rb +17 -8
  30. data/spec/frame/masking_spec.rb +2 -1
  31. data/spec/frame/outgoing_03_spec.rb +2 -1
  32. data/spec/frame/outgoing_04_spec.rb +2 -1
  33. data/spec/frame/outgoing_05_spec.rb +2 -1
  34. data/spec/frame/outgoing_07_spec.rb +2 -1
  35. data/spec/frame/outgoing_75_spec.rb +2 -1
  36. data/spec/frame/outgoing_common_spec.rb +10 -4
  37. data/spec/handshake/client_04_spec.rb +3 -3
  38. data/spec/handshake/client_11_spec.rb +2 -2
  39. data/spec/handshake/client_75_spec.rb +1 -1
  40. data/spec/handshake/client_76_spec.rb +3 -3
  41. data/spec/handshake/server_04_spec.rb +2 -2
  42. data/spec/handshake/server_76_spec.rb +8 -8
  43. data/spec/spec_helper.rb +0 -2
  44. data/spec/support/all_client_drafts.rb +21 -21
  45. data/spec/support/all_server_drafts.rb +19 -16
  46. data/spec/support/incoming_frames.rb +29 -12
  47. data/spec/support/outgoing_frames.rb +28 -8
  48. data/websocket.gemspec +2 -4
  49. metadata +7 -61
@@ -1,14 +1,15 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Incoming frame draft 04' do
6
+ subject { frame }
5
7
  let(:version) { 4 }
6
8
  let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) }
7
9
  let(:encoded_text) { nil }
8
10
  let(:decoded_text) { nil }
9
11
  let(:frame_type) { nil }
10
12
  let(:error) { nil }
11
- subject { frame }
12
13
 
13
14
  it_should_behave_like 'valid_incoming_frame'
14
15
 
@@ -54,7 +55,7 @@ RSpec.describe 'Incoming frame draft 04' do
54
55
 
55
56
  context 'should properly decode text frame in between of continuation' do
56
57
  let(:encoded_text) { "\x04\x03Hel\x83\x03abc\x80\x02lo" }
57
- let(:frame_type) { [:pong, :text] }
58
+ let(:frame_type) { %i(pong text) }
58
59
  let(:decoded_text) { %w(abc Hello) }
59
60
 
60
61
  it_should_behave_like 'valid_incoming_frame'
@@ -1,14 +1,15 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Incoming frame draft 05' do
6
+ subject { frame }
5
7
  let(:version) { 5 }
6
8
  let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) }
7
9
  let(:encoded_text) { nil }
8
10
  let(:decoded_text) { nil }
9
11
  let(:frame_type) { nil }
10
12
  let(:error) { nil }
11
- subject { frame }
12
13
 
13
14
  it_should_behave_like 'valid_incoming_frame'
14
15
 
@@ -70,7 +71,7 @@ RSpec.describe 'Incoming frame draft 05' do
70
71
 
71
72
  context 'should properly decode text frame in between of continuation' do
72
73
  let(:encoded_text) { "\x04\x03Hel\x83\x03abc\x80\x02lo" }
73
- let(:frame_type) { [:pong, :text] }
74
+ let(:frame_type) { %i(pong text) }
74
75
  let(:decoded_text) { %w(abc Hello) }
75
76
 
76
77
  it_should_behave_like 'valid_incoming_frame'
@@ -1,14 +1,15 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Incoming frame draft 07' do
6
+ subject { frame }
5
7
  let(:version) { 7 }
6
8
  let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) }
7
9
  let(:encoded_text) { nil }
8
10
  let(:decoded_text) { nil }
9
11
  let(:frame_type) { nil }
10
12
  let(:error) { nil }
11
- subject { frame }
12
13
 
13
14
  it_should_behave_like 'valid_incoming_frame'
14
15
 
@@ -87,7 +88,7 @@ RSpec.describe 'Incoming frame draft 07' do
87
88
 
88
89
  context 'should properly decode text frame in between of continuation' do
89
90
  let(:encoded_text) { "\x01\x03Hel\x8a\x03abc\x80\x02lo" }
90
- let(:frame_type) { [:pong, :text] }
91
+ let(:frame_type) { %i(pong text) }
91
92
  let(:decoded_text) { %w(abc Hello) }
92
93
 
93
94
  it_should_behave_like 'valid_incoming_frame'
@@ -1,14 +1,15 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Incoming frame draft 75' do
6
+ subject { frame }
5
7
  let(:version) { 75 }
6
8
  let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) }
7
9
  let(:encoded_text) { nil }
8
10
  let(:decoded_text) { nil }
9
11
  let(:frame_type) { nil }
10
12
  let(:error) { nil }
11
- subject { frame }
12
13
 
13
14
  it_should_behave_like 'valid_incoming_frame'
14
15
 
@@ -23,7 +24,7 @@ RSpec.describe 'Incoming frame draft 75' do
23
24
  context 'with two frames' do
24
25
  let(:encoded_text) { "\x00abc\xFF\x00def\xFF" }
25
26
  let(:decoded_text) { %w(abc def) }
26
- let(:frame_type) { [:text, :text] }
27
+ let(:frame_type) { %i(text text) }
27
28
 
28
29
  it_should_behave_like 'valid_incoming_frame'
29
30
  end
@@ -1,22 +1,31 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Incoming common frame' do
5
6
  subject { WebSocket::Frame::Incoming.new }
6
7
 
7
- its(:version) { is_expected.to eql(13) }
8
- its(:decoded?) { is_expected.to be false }
9
- its(:error?) { is_expected.to be false }
8
+ it 'is version 13' do
9
+ expect(subject.version).to be 13
10
+ end
11
+
12
+ it 'is not decoded' do
13
+ expect(subject.decoded?).to be false
14
+ end
15
+
16
+ it 'has no errors' do
17
+ expect(subject.error?).to be false
18
+ end
10
19
 
11
- it 'should allow adding data via <<' do
12
- expect(subject.data).to eql('')
20
+ it 'allows adding data via <<' do
21
+ expect(subject.data).to eql ''
13
22
  subject << 'test'
14
- expect(subject.data).to eql('test')
23
+ expect(subject.data).to eql 'test'
15
24
  end
16
25
 
17
- it 'should raise error on invalid version' do
26
+ it 'raises error on invalid version' do
18
27
  subject = WebSocket::Frame::Incoming.new(version: 70)
19
28
  expect(subject.error?).to be true
20
- expect(subject.error).to eql(:unknown_protocol_version)
29
+ expect(subject.error).to be :unknown_protocol_version
21
30
  end
22
31
  end
@@ -1,8 +1,9 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Masking frame draft 07' do
5
- it 'should encode and decode masked frame correctly' do
6
+ it 'encodes and decode masked frame correctly' do
6
7
  outgoing_frame = WebSocket::Frame::Outgoing::Client.new(data: 'Hello World', type: 'text')
7
8
  outgoing_frame.to_s
8
9
  expect(outgoing_frame.error).to be_nil
@@ -1,7 +1,9 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Outgoing frame draft 03' do
6
+ subject { frame }
5
7
  let(:version) { 3 }
6
8
  let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) }
7
9
  let(:decoded_text) { '' }
@@ -9,7 +11,6 @@ RSpec.describe 'Outgoing frame draft 03' do
9
11
  let(:frame_type) { :text }
10
12
  let(:require_sending) { true }
11
13
  let(:error) { nil }
12
- subject { frame }
13
14
 
14
15
  it_should_behave_like 'valid_outgoing_frame'
15
16
 
@@ -1,7 +1,9 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Outgoing frame draft 04' do
6
+ subject { frame }
5
7
  let(:version) { 4 }
6
8
  let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) }
7
9
  let(:decoded_text) { '' }
@@ -9,7 +11,6 @@ RSpec.describe 'Outgoing frame draft 04' do
9
11
  let(:frame_type) { :text }
10
12
  let(:require_sending) { true }
11
13
  let(:error) { nil }
12
- subject { frame }
13
14
 
14
15
  it_should_behave_like 'valid_outgoing_frame'
15
16
 
@@ -1,7 +1,9 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Outgoing frame draft 05' do
6
+ subject { frame }
5
7
  let(:version) { 5 }
6
8
  let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) }
7
9
  let(:decoded_text) { '' }
@@ -9,7 +11,6 @@ RSpec.describe 'Outgoing frame draft 05' do
9
11
  let(:frame_type) { :text }
10
12
  let(:require_sending) { true }
11
13
  let(:error) { nil }
12
- subject { frame }
13
14
 
14
15
  it_should_behave_like 'valid_outgoing_frame'
15
16
 
@@ -1,7 +1,9 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Outgoing frame draft 07' do
6
+ subject { frame }
5
7
  let(:version) { 7 }
6
8
  let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type, code: close_code) }
7
9
  let(:decoded_text) { '' }
@@ -10,7 +12,6 @@ RSpec.describe 'Outgoing frame draft 07' do
10
12
  let(:frame_type) { :text }
11
13
  let(:require_sending) { true }
12
14
  let(:error) { nil }
13
- subject { frame }
14
15
 
15
16
  it_should_behave_like 'valid_outgoing_frame'
16
17
 
@@ -1,7 +1,9 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Outgoing frame draft 75' do
6
+ subject { frame }
5
7
  let(:version) { 75 }
6
8
  let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) }
7
9
  let(:decoded_text) { '' }
@@ -9,7 +11,6 @@ RSpec.describe 'Outgoing frame draft 75' do
9
11
  let(:frame_type) { :text }
10
12
  let(:require_sending) { true }
11
13
  let(:error) { nil }
12
- subject { frame }
13
14
 
14
15
  it_should_behave_like 'valid_outgoing_frame'
15
16
 
@@ -1,15 +1,21 @@
1
1
  # encoding: binary
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe 'Outgoing common frame' do
5
6
  subject { WebSocket::Frame::Outgoing.new }
6
7
 
7
- its(:version) { is_expected.to eql(13) }
8
- its(:error?) { is_expected.to be false }
8
+ it 'is version 13' do
9
+ expect(subject.version).to be 13
10
+ end
11
+
12
+ it 'has no errors' do
13
+ expect(subject.error?).to be false
14
+ end
9
15
 
10
- it 'should raise error on invalid version' do
16
+ it 'raises error on invalid version' do
11
17
  subject = WebSocket::Frame::Incoming.new(version: 70)
12
18
  expect(subject.error?).to be true
13
- expect(subject.error).to eql(:unknown_protocol_version)
19
+ expect(subject.error).to be :unknown_protocol_version
14
20
  end
15
21
  end
@@ -9,13 +9,13 @@ RSpec.describe 'Client draft 4 handshake' do
9
9
 
10
10
  it_should_behave_like 'all client drafts'
11
11
 
12
- it 'should disallow client with invalid challenge' do
12
+ it 'disallows client with invalid challenge' do
13
13
  @request_params = { accept: 'invalid' }
14
14
  handshake << server_response
15
15
 
16
16
  expect(handshake).to be_finished
17
17
  expect(handshake).not_to be_valid
18
- expect(handshake.error).to eql(:invalid_handshake_authentication)
18
+ expect(handshake.error).to be(:invalid_handshake_authentication)
19
19
  end
20
20
 
21
21
  context 'protocol header specified' do
@@ -54,7 +54,7 @@ RSpec.describe 'Client draft 4 handshake' do
54
54
 
55
55
  expect(handshake).to be_finished
56
56
  expect(handshake).not_to be_valid
57
- expect(handshake.error).to eql(:unsupported_protocol)
57
+ expect(handshake.error).to be(:unsupported_protocol)
58
58
  end
59
59
  end
60
60
  end
@@ -9,12 +9,12 @@ RSpec.describe 'Client draft 11 handshake' do
9
9
 
10
10
  it_should_behave_like 'all client drafts'
11
11
 
12
- it 'should disallow client with invalid challenge' do
12
+ it 'disallows client with invalid challenge' do
13
13
  @request_params = { accept: 'invalid' }
14
14
  handshake << server_response
15
15
 
16
16
  expect(handshake).to be_finished
17
17
  expect(handshake).not_to be_valid
18
- expect(handshake.error).to eql(:invalid_handshake_authentication)
18
+ expect(handshake.error).to be(:invalid_handshake_authentication)
19
19
  end
20
20
  end
@@ -29,7 +29,7 @@ RSpec.describe 'Client draft 75 handshake' do
29
29
 
30
30
  expect(handshake).to be_finished
31
31
  expect(handshake).not_to be_valid
32
- expect(handshake.error).to eql(:unsupported_protocol)
32
+ expect(handshake.error).to be(:unsupported_protocol)
33
33
  end
34
34
  end
35
35
  end
@@ -9,13 +9,13 @@ RSpec.describe 'Client draft 76 handshake' do
9
9
 
10
10
  it_should_behave_like 'all client drafts'
11
11
 
12
- it 'should disallow client with invalid challenge' do
12
+ it 'disallows client with invalid challenge' do
13
13
  @request_params = { challenge: 'invalid' }
14
14
  handshake << server_response
15
15
 
16
16
  expect(handshake).to be_finished
17
17
  expect(handshake).not_to be_valid
18
- expect(handshake.error).to eql(:invalid_handshake_authentication)
18
+ expect(handshake.error).to be(:invalid_handshake_authentication)
19
19
  end
20
20
 
21
21
  context 'protocol header specified' do
@@ -38,7 +38,7 @@ RSpec.describe 'Client draft 76 handshake' do
38
38
 
39
39
  expect(handshake).to be_finished
40
40
  expect(handshake).not_to be_valid
41
- expect(handshake.error).to eql(:unsupported_protocol)
41
+ expect(handshake.error).to be(:unsupported_protocol)
42
42
  end
43
43
  end
44
44
  end
@@ -8,12 +8,12 @@ RSpec.describe 'Server draft 04 handshake' do
8
8
 
9
9
  it_should_behave_like 'all server drafts'
10
10
 
11
- it 'should disallow request without Sec-WebSocket-Key' do
11
+ it 'disallows request without Sec-WebSocket-Key' do
12
12
  handshake << client_request.gsub(/^Sec-WebSocket-Key:.*\n/, '')
13
13
 
14
14
  expect(handshake).to be_finished
15
15
  expect(handshake).not_to be_valid
16
- expect(handshake.error).to eql(:invalid_handshake_authentication)
16
+ expect(handshake.error).to be(:invalid_handshake_authentication)
17
17
  end
18
18
 
19
19
  context 'protocol header specified' do
@@ -8,40 +8,40 @@ RSpec.describe 'Server draft 76 handshake' do
8
8
 
9
9
  it_should_behave_like 'all server drafts'
10
10
 
11
- it 'should disallow request without spaces in key 1' do
11
+ it 'disallows request without spaces in key 1' do
12
12
  @request_params = { key1: '4@146546xW%0l15' }
13
13
  handshake << client_request
14
14
 
15
15
  expect(handshake).to be_finished
16
16
  expect(handshake).not_to be_valid
17
- expect(handshake.error).to eql(:invalid_handshake_authentication)
17
+ expect(handshake.error).to be(:invalid_handshake_authentication)
18
18
  end
19
19
 
20
- it 'should disallow request without spaces in key 2' do
20
+ it 'disallows request without spaces in key 2' do
21
21
  @request_params = { key2: '129985Y31.P00' }
22
22
  handshake << client_request
23
23
 
24
24
  expect(handshake).to be_finished
25
25
  expect(handshake).not_to be_valid
26
- expect(handshake.error).to eql(:invalid_handshake_authentication)
26
+ expect(handshake.error).to be(:invalid_handshake_authentication)
27
27
  end
28
28
 
29
- it 'should disallow request with invalid number of spaces or numbers in key 1' do
29
+ it 'disallows request with invalid number of spaces or numbers in key 1' do
30
30
  @request_params = { key1: '4 @1 46546xW%0l 1 5' }
31
31
  handshake << client_request
32
32
 
33
33
  expect(handshake).to be_finished
34
34
  expect(handshake).not_to be_valid
35
- expect(handshake.error).to eql(:invalid_handshake_authentication)
35
+ expect(handshake.error).to be(:invalid_handshake_authentication)
36
36
  end
37
37
 
38
- it 'should disallow request with invalid number of spaces or numbers in key 2' do
38
+ it 'disallows request with invalid number of spaces or numbers in key 2' do
39
39
  @request_params = { key2: '12998 5 Y3 1 .P00' }
40
40
  handshake << client_request
41
41
 
42
42
  expect(handshake).to be_finished
43
43
  expect(handshake).not_to be_valid
44
- expect(handshake.error).to eql(:invalid_handshake_authentication)
44
+ expect(handshake.error).to be(:invalid_handshake_authentication)
45
45
  end
46
46
 
47
47
  context 'protocol header specified' do
@@ -1,6 +1,4 @@
1
1
  require 'rspec'
2
- require 'rspec/its'
3
- require 'webrick'
4
2
 
5
3
  require 'websocket'
6
4
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -9,7 +9,7 @@ RSpec.shared_examples_for 'all client drafts' do
9
9
  expect(handshake).to be_valid
10
10
  end
11
11
 
12
- it 'should be valid' do
12
+ it 'is valid' do
13
13
  handshake << server_response
14
14
 
15
15
  expect(handshake.error).to be_nil
@@ -17,92 +17,92 @@ RSpec.shared_examples_for 'all client drafts' do
17
17
  expect(handshake).to be_valid
18
18
  end
19
19
 
20
- it 'should return valid version' do
20
+ it 'returns valid version' do
21
21
  expect(handshake.version).to eql(version)
22
22
  end
23
23
 
24
- it 'should return valid host' do
24
+ it 'returns valid host' do
25
25
  @request_params = { host: 'www.test.cc' }
26
26
  expect(handshake.host).to eql('www.test.cc')
27
27
  end
28
28
 
29
- it 'should return valid path' do
29
+ it 'returns valid path' do
30
30
  @request_params = { path: '/custom' }
31
31
  expect(handshake.path).to eql('/custom')
32
32
  end
33
33
 
34
- it 'should return valid query' do
34
+ it 'returns valid query' do
35
35
  @request_params = { query: 'aaa=bbb' }
36
36
  expect(handshake.query).to eql('aaa=bbb')
37
37
  end
38
38
 
39
- it 'should return valid port' do
39
+ it 'returns valid port' do
40
40
  @request_params = { port: 123 }
41
- expect(handshake.port).to eql(123)
41
+ expect(handshake.port).to be(123)
42
42
  end
43
43
 
44
- it 'should return valid headers' do
44
+ it 'returns valid headers' do
45
45
  @request_params = { headers: { 'aaa' => 'bbb' } }
46
46
  expect(handshake.headers).to eql('aaa' => 'bbb')
47
47
  end
48
48
 
49
- it 'should parse uri' do
49
+ it 'parses uri' do
50
50
  @request_params = { uri: 'ws://test.example.org:301/test_path?query=true' }
51
51
  expect(handshake.host).to eql('test.example.org')
52
- expect(handshake.port).to eql(301)
52
+ expect(handshake.port).to be(301)
53
53
  expect(handshake.path).to eql('/test_path')
54
54
  expect(handshake.query).to eql('query=true')
55
55
  end
56
56
 
57
- it 'should parse url' do
57
+ it 'parses url' do
58
58
  @request_params = { url: 'ws://test.example.org:301/test_path?query=true' }
59
59
  expect(handshake.host).to eql('test.example.org')
60
- expect(handshake.port).to eql(301)
60
+ expect(handshake.port).to be(301)
61
61
  expect(handshake.path).to eql('/test_path')
62
62
  expect(handshake.query).to eql('query=true')
63
63
  end
64
64
 
65
- it 'should resolve correct path with root server provided' do
65
+ it 'resolves correct path with root server provided' do
66
66
  @request_params = { url: 'ws://test.example.org' }
67
67
  expect(handshake.path).to eql('/')
68
68
  end
69
69
 
70
- it 'should return valid response' do
70
+ it 'returns valid response' do
71
71
  validate_request
72
72
  end
73
73
 
74
- it 'should allow custom path' do
74
+ it 'allows custom path' do
75
75
  @request_params = { path: '/custom' }
76
76
  validate_request
77
77
  end
78
78
 
79
- it 'should allow query in path' do
79
+ it 'allows query in path' do
80
80
  @request_params = { query: 'test=true' }
81
81
  validate_request
82
82
  end
83
83
 
84
- it 'should allow custom port' do
84
+ it 'allows custom port' do
85
85
  @request_params = { port: 123 }
86
86
  validate_request
87
87
  end
88
88
 
89
- it 'should allow custom headers' do
89
+ it 'allows custom headers' do
90
90
  @request_params = { headers: { 'aaa' => 'bbb' } }
91
91
  validate_request
92
92
  end
93
93
 
94
- it 'should recognize unfinished requests' do
94
+ it 'recognizes unfinished requests' do
95
95
  handshake << server_response[0..-20]
96
96
 
97
97
  expect(handshake).not_to be_finished
98
98
  expect(handshake).not_to be_valid
99
99
  end
100
100
 
101
- it 'should disallow requests with invalid request method' do
101
+ it 'disallows requests with invalid request method' do
102
102
  handshake << server_response.gsub('101', '404')
103
103
 
104
104
  expect(handshake).to be_finished
105
105
  expect(handshake).not_to be_valid
106
- expect(handshake.error).to eql(:invalid_status_code)
106
+ expect(handshake.error).to be(:invalid_status_code)
107
107
  end
108
108
  end