cucumber-wire 6.2.1 → 8.0.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -90
- data/LICENSE +17 -18
- data/README.md +8 -8
- data/lib/cucumber/wire/add_hooks_filter.rb +4 -4
- data/lib/cucumber/wire/configuration.rb +5 -2
- data/lib/cucumber/wire/connection.rb +8 -3
- data/lib/cucumber/wire/connections.rb +5 -2
- data/lib/cucumber/wire/data_packet.rb +6 -3
- data/lib/cucumber/wire/exception.rb +14 -9
- data/lib/cucumber/wire/plugin.rb +2 -0
- data/lib/cucumber/wire/protocol/requests.rb +26 -15
- data/lib/cucumber/wire/protocol.rb +2 -1
- data/lib/cucumber/wire/request_handler.rb +10 -7
- data/lib/cucumber/wire/snippet.rb +6 -4
- data/lib/cucumber/wire/step_argument.rb +3 -1
- data/lib/cucumber/wire/step_definition.rb +11 -6
- data/lib/cucumber/wire.rb +2 -0
- metadata +109 -67
- data/CONTRIBUTING.md +0 -2
- data/lib/cucumber/wire/version +0 -1
- data/spec/cucumber/wire/configuration_spec.rb +0 -63
- data/spec/cucumber/wire/connection_spec.rb +0 -64
- data/spec/cucumber/wire/connections_spec.rb +0 -23
- data/spec/cucumber/wire/data_packet_spec.rb +0 -43
- data/spec/cucumber/wire/exception_spec.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67804fb6185fce9e80fecb0fa7875bcc8c67b4453ba3d175d1123e1e4f7b1f53
|
4
|
+
data.tar.gz: 273f55d1db741f40876284e6a8901dd35c95948cc6e96f4dc1309f825abaa7fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc7f21f800471aa5c2755944b7544cda0e976930ce1796e7bb0364dde63a6a843a4e80cb98b8291f4d921c5b5de159743a000e248e4af997c0a923f0dbfa4b76
|
7
|
+
data.tar.gz: 310728205278fbce127e06b9beb5c6fc7f6eb4cdf2fc869e840eeb1112f6ee7a95157e7c3ec88acfd69ce0686d750448252ea752409a63145fa52338097a570c
|
data/CHANGELOG.md
CHANGED
@@ -10,38 +10,40 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
|
|
10
10
|
|
11
11
|
## [Unreleased]
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
## [8.0.0] - 2025-10-14
|
15
14
|
### Added
|
15
|
+
- Added some basic rubocop compliance to suite (More fixes to come) ([#69](https://github.com/cucumber/cucumber-ruby-wire/pull/69) [#70](https://github.com/cucumber/cucumber-ruby-wire/pull/70) [#84](https://github.com/cucumber/cucumber-ruby-wire/pull/84))
|
16
16
|
|
17
|
-
###
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
## [6.2.1]
|
17
|
+
### Changed
|
18
|
+
- Minimum ruby version is now 3.1 ([#82](https://github.com/cucumber/cucumber-ruby-wire/pull/82))
|
19
|
+
- Enabled latest versions of `cucumber-core` and `cucumber-expressions` ([#82](https://github.com/cucumber/cucumber-ruby-wire/pull/82))
|
22
20
|
|
23
21
|
### Fixed
|
22
|
+
- When unknown errors are called, a more Ruby 3.5-esque way of displaying `NoMethodError` is performed ([#85](https://github.com/cucumber/cucumber-ruby-wire/pull/85))
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
## [7.0.0] - 2023-11-10
|
25
|
+
### Changed
|
26
|
+
- Minimum ruby version is now 2.6 ([#68](https://github.com/cucumber/cucumber-ruby-wire/pull/68))
|
27
|
+
- Compatibility with cucumber versions up to cucumber 9.x now added ([#68](https://github.com/cucumber/cucumber-ruby-wire/pull/68))
|
28
28
|
|
29
|
-
|
29
|
+
### Fixed
|
30
|
+
- Fixed up some basic style incompatibilities with old rspec tests ([#68](https://github.com/cucumber/cucumber-ruby-wire/pull/68))
|
30
31
|
|
31
|
-
## [6.2.
|
32
|
+
## [6.2.1] - 2022-01-07
|
33
|
+
### Fixed
|
34
|
+
- Fix usage with message-related formatters like `html-formatter` ([#57](https://github.com/cucumber/cucumber-ruby-wire/pull/57))
|
35
|
+
- Removed dependency to `cucumber-messages`
|
32
36
|
|
37
|
+
## [6.2.0] - 2021-10-12
|
33
38
|
### Changed
|
34
|
-
|
35
39
|
- Patched `cucumber-core`, `cucumber-expressions` and `cucumber-messages`
|
36
40
|
|
37
|
-
## [6.1.1]
|
38
|
-
|
41
|
+
## [6.1.1] - 2021-08-27
|
39
42
|
### Changed
|
40
|
-
|
41
43
|
- Use the new `InstallPlugin` hook rather than `AfterConfiguration`.
|
42
|
-
|
44
|
+
([#52](https://github.com/cucumber/cucumber-ruby-wire/pull/52))
|
43
45
|
|
44
|
-
## [6.1.0]
|
46
|
+
## [6.1.0] - 2021-08-09
|
45
47
|
### Added
|
46
48
|
- The possibility to verify if the plugin has already been installed or not. To
|
47
49
|
do so, use `Cucumber::Wire::Plugin.installed?`.
|
@@ -51,89 +53,22 @@ do so, use `Cucumber::Wire::Plugin.installed?`.
|
|
51
53
|
- `cucumber-wire` is now able to install itself as a plugin into `cucumber-ruby`.
|
52
54
|
([46](https://github.com/cucumber/cucumber-ruby-wire/pull/46))
|
53
55
|
|
54
|
-
## [6.0.1]
|
56
|
+
## [6.0.1] - 2021-07-19
|
55
57
|
### Changed
|
56
58
|
- Patched `cucumber-core` and `cucumber-messages`
|
57
59
|
|
58
|
-
## [6.0.0]
|
60
|
+
## [6.0.0] - 2021-07-09
|
59
61
|
### Changed
|
60
62
|
- Updated `cucumber-core` ~> 10.0.0 and `cucumber-messages` ~> 17.0.0
|
61
63
|
This brings breaking changes because of internal changes in Cucumber::Messages.
|
62
64
|
([#44](https://github.com/cucumber/cucumber-ruby-wire/pull/44))
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
## [5.0.0]
|
69
|
-
### Changed
|
70
|
-
- Update from cucumber-expressions 10 to 12 introduces significant underlying changes
|
71
|
-
in how step definitions are matched. This should be backward compatible but there
|
72
|
-
is a risk of regressions.
|
73
|
-
- Updated dependencies (look at the diff for details)
|
74
|
-
|
75
|
-
## [4.0.1]
|
76
|
-
### Changed
|
77
|
-
- Updated dependencies (look at the diff for details)
|
78
|
-
|
79
|
-
## [3.1.0]
|
80
|
-
### Changed
|
81
|
-
- `cucumber-core` ~> 7.1.0
|
82
|
-
- `cucumber-messages` ~> 12.2.0
|
83
|
-
- Updated gems:
|
84
|
-
|
85
|
-
## [3.0.0]
|
86
|
-
### Changed
|
87
|
-
- Use `cucumber-ruby-core` 7.0.0
|
88
|
-
- cucumber-cucumber-expressions ~> 10
|
89
|
-
- cucumber-messages ~> 12
|
90
|
-
- Updated monorepo libraries:
|
91
|
-
|
92
|
-
## [2.0.1]
|
93
|
-
### Removed
|
94
|
-
- Replace use of `MultiJSON` to use native JSON gem
|
95
|
-
|
96
|
-
## [2.0.0]
|
97
|
-
### Changed
|
98
|
-
- Use `cucumber-ruby-core` 6.0.0
|
99
|
-
|
100
|
-
## [1.2.0]
|
101
|
-
### Added
|
102
|
-
- Use `Cucumber:Messages::IdGenerator::UUID` to provide ids for `Hooks`
|
103
|
-
|
104
|
-
### Removed
|
105
|
-
- Multiline arguments do not need `Location` anymore
|
106
|
-
|
107
|
-
## [1.1.0]
|
108
|
-
### Changed
|
109
|
-
- Update to cucumber-expressions 8.0.2
|
110
|
-
- Update to cucumber 4.0.0
|
111
|
-
|
112
|
-
## [1.0.0]
|
113
|
-
### Added
|
114
|
-
- Added this CHANGELOG.md file per [cucumber/cucumber #251](https://github.com/cucumber/cucumber/issues/251) ([#13](https://github.com/cucumber/cucumber-ruby-wire/pull/13) [jaysonesmith](https://github.com/jaysonesmith))
|
115
|
-
|
116
|
-
### Changed
|
117
|
-
- Changes to work with a modern Cucumber-Ruby ([#14](https://github.com/cucumber/cucumber-ruby-wire/pull/14) [brasmusson](https://github.com/brasmusson))
|
118
|
-
- Adapt to the move of Location to Cucumber::Core::Test ([#14](https://github.com/cucumber/cucumber-ruby-wire/pull/14) [brasmusson](https://github.com/brasmusson))
|
119
|
-
|
120
|
-
[Unreleased]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.2.1...main
|
66
|
+
[Unreleased]: https://github.com/cucumber/cucumber-ruby-wire/compare/v8.0.0...HEAD
|
67
|
+
[8.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v7.0.0...v8.0.0
|
68
|
+
[7.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.2.1...v7.0.0
|
121
69
|
[6.2.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.2.0...v6.2.1
|
122
70
|
[6.2.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.1.1...v6.2.0
|
123
71
|
[6.1.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.1.0...v6.1.1
|
124
72
|
[6.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.1...v6.1.0
|
125
73
|
[6.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.0...v6.0.1
|
126
74
|
[6.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v5.0.1...v6.0.0
|
127
|
-
[5.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v5.0.0...v5.0.1
|
128
|
-
[5.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v4.0.1...v5.0.0
|
129
|
-
[4.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v4.0.0...v4.0.1
|
130
|
-
[3.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v3.0.0...v3.1.0
|
131
|
-
[3.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v2.0.1...v3.0.0
|
132
|
-
[2.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v2.0.0...v2.0.1
|
133
|
-
[2.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v1.2.0...v2.0.0
|
134
|
-
[1.2.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v1.1.0...v1.2.0
|
135
|
-
[1.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v1.0.0...v1.1.0
|
136
|
-
[1.0.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v0.0.1...v1.0.0
|
137
|
-
ire/compare/v6.1.0...main
|
138
|
-
[6.1.0]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.1...v6.1.0
|
139
|
-
[6.0.1]: https://github.com/cucumber/cucumber-ruby-wire/compare/v6.0.0...v6.0.1
|
data/LICENSE
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2015 Cucumber Ltd
|
3
|
+
Copyright (c) 2015 Cucumber Ltd and contributors
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
[](https://github.com/cucumber/cucumber-ruby-wire/actions/workflows/test.yaml)
|
2
2
|
|
3
3
|
# cucumber-wire
|
4
4
|
|
5
|
-
This gem was extracted from the [cucumber gem](https://github.com/cucumber/cucumber-ruby)
|
5
|
+
This gem was extracted from the [cucumber gem](https://github.com/cucumber/cucumber-ruby)
|
6
6
|
|
7
|
-
|
7
|
+
This is available as an optional runtime dependency for cucumber-ruby and also as a runtime dependency for cucumber cpp.
|
8
8
|
|
9
|
-
|
9
|
+
The tests here are a bit hairy and prone to the occasional flicker.
|
10
10
|
|
11
11
|
## Configuration
|
12
12
|
|
13
|
-
You can configure the connection using a
|
13
|
+
You can configure the connection using a YML file called a `.wire` file:
|
14
14
|
|
15
|
-
```
|
15
|
+
```yml
|
16
16
|
host: localhost
|
17
17
|
port: 54321
|
18
18
|
timeout:
|
@@ -26,11 +26,11 @@ timeout:
|
|
26
26
|
|
27
27
|
The default timeout is 120 seconds. `connect` has a default timeout of 11 seconds.
|
28
28
|
|
29
|
-
###
|
29
|
+
### YML with ERB templating
|
30
30
|
|
31
31
|
The file format is YAML, with ERB templating, so you could make the configuration configurable:
|
32
32
|
|
33
|
-
```
|
33
|
+
```yml,erb
|
34
34
|
host: localhost
|
35
35
|
port: 54321
|
36
36
|
timeout:
|
@@ -1,12 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Cucumber
|
4
4
|
module Wire
|
5
5
|
class AddHooksFilter < Core::Filter.new(:connections)
|
6
6
|
def test_case(test_case)
|
7
|
-
test_case
|
8
|
-
with_steps([before_hook(test_case)] + test_case.test_steps + [after_hook(test_case)])
|
9
|
-
describe_to receiver
|
7
|
+
test_case
|
8
|
+
.with_steps([before_hook(test_case)] + test_case.test_steps + [after_hook(test_case)])
|
9
|
+
.describe_to receiver
|
10
10
|
end
|
11
11
|
|
12
12
|
def before_hook(test_case)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
require 'erb'
|
3
5
|
|
@@ -14,16 +16,17 @@ module Cucumber
|
|
14
16
|
def initialize(args)
|
15
17
|
@host = args['host']
|
16
18
|
@port = args['port']
|
17
|
-
@unix = args['unix']
|
19
|
+
@unix = args['unix'] unless RUBY_PLATFORM.match?(/mingw|mswin/)
|
18
20
|
@timeouts = DEFAULT_TIMEOUTS.merge(args['timeout'] || {})
|
19
21
|
end
|
20
22
|
|
21
23
|
def timeout(message = nil)
|
22
|
-
|
24
|
+
@timeouts[message.to_s] || 3
|
23
25
|
end
|
24
26
|
|
25
27
|
def to_s
|
26
28
|
return @unix if @unix
|
29
|
+
|
27
30
|
"#{@host}:#{@port}"
|
28
31
|
end
|
29
32
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'timeout'
|
2
4
|
require 'cucumber/wire/protocol'
|
3
5
|
require 'cucumber/wire/exception'
|
@@ -22,7 +24,8 @@ module Cucumber
|
|
22
24
|
response = fetch_data_from_socket(@config.timeout(message))
|
23
25
|
response.handle_with(request_handler)
|
24
26
|
rescue Timeout::Error => e
|
25
|
-
backtrace = e.backtrace
|
27
|
+
backtrace = e.backtrace
|
28
|
+
backtrace.shift # because Timeout puts some weird stuff in there
|
26
29
|
raise Timeout::Error, "Timed out calling wire server with message '#{message}'", backtrace
|
27
30
|
end
|
28
31
|
end
|
@@ -44,18 +47,20 @@ module Cucumber
|
|
44
47
|
else
|
45
48
|
Timeout.timeout(timeout) { socket.gets }
|
46
49
|
end
|
47
|
-
raise exception({'message' => "Remote Socket with #{@config.host}:#{@config.port} closed."}) if raw_response.nil?
|
50
|
+
raise exception({ 'message' => "Remote Socket with #{@config.host}:#{@config.port} closed." }) if raw_response.nil?
|
51
|
+
|
48
52
|
DataPacket.parse(raw_response)
|
49
53
|
end
|
50
54
|
|
51
55
|
def socket
|
52
56
|
return @socket if @socket
|
57
|
+
|
53
58
|
if @config.unix
|
54
59
|
@socket = UNIXSocket.new(@config.unix)
|
55
60
|
else
|
56
61
|
@socket = TCPSocket.new(@config.host, @config.port)
|
57
62
|
end
|
58
|
-
rescue Errno::ECONNREFUSED
|
63
|
+
rescue Errno::ECONNREFUSED
|
59
64
|
raise(ConnectionError, "Unable to contact the wire server at #{@config}. Is it up?")
|
60
65
|
end
|
61
66
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'json'
|
2
4
|
require 'socket'
|
3
5
|
require 'cucumber/wire/connection'
|
@@ -11,13 +13,13 @@ require 'cucumber/step_match'
|
|
11
13
|
|
12
14
|
module Cucumber
|
13
15
|
module Wire
|
14
|
-
|
15
16
|
class Connections
|
16
17
|
attr_reader :connections, :configuration, :registry
|
17
18
|
private :connections
|
18
19
|
|
19
20
|
def initialize(connections, configuration, registry)
|
20
21
|
raise ArgumentError unless connections
|
22
|
+
|
21
23
|
@connections = connections
|
22
24
|
@configuration = configuration
|
23
25
|
@registry = registry
|
@@ -26,12 +28,13 @@ module Cucumber
|
|
26
28
|
def find_match(test_step)
|
27
29
|
matches = step_matches(test_step.name)
|
28
30
|
return unless matches.any?
|
31
|
+
|
29
32
|
# TODO: handle ambiguous matches (push to cucumber?)
|
30
33
|
matches.first
|
31
34
|
end
|
32
35
|
|
33
36
|
def step_matches(step_name)
|
34
|
-
connections.map{ |c| c.step_matches(step_name, @registry)}.flatten
|
37
|
+
connections.map { |c| c.step_matches(step_name, @registry) }.flatten
|
35
38
|
end
|
36
39
|
|
37
40
|
def begin_scenario(test_case)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'json'
|
2
4
|
|
3
5
|
module Cucumber
|
@@ -17,17 +19,18 @@ module Cucumber
|
|
17
19
|
attr_reader :message, :params
|
18
20
|
|
19
21
|
def initialize(message, params = nil)
|
20
|
-
@message
|
22
|
+
@message = message
|
23
|
+
@params = params
|
21
24
|
end
|
22
25
|
|
23
|
-
def to_json
|
26
|
+
def to_json(*_args)
|
24
27
|
packet = [@message]
|
25
28
|
packet << @params if @params
|
26
29
|
JSON.generate(packet)
|
27
30
|
end
|
28
31
|
|
29
32
|
def handle_with(handler)
|
30
|
-
handler.send("handle_#{@message}", @params)
|
33
|
+
handler.send(:"handle_#{@message}", @params)
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end
|
@@ -1,27 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Wire
|
3
|
-
# Proxy for an exception that
|
5
|
+
# Proxy for an exception that occurred at the remote end of the wire
|
4
6
|
class Exception < StandardError
|
5
7
|
module CanSetName
|
6
8
|
attr_writer :exception_name
|
9
|
+
|
7
10
|
def to_s
|
8
11
|
@exception_name
|
9
12
|
end
|
10
13
|
end
|
11
14
|
|
12
15
|
def initialize(args, config)
|
13
|
-
super
|
16
|
+
super(args['message'])
|
17
|
+
|
14
18
|
if args['exception']
|
15
19
|
self.class.extend(CanSetName)
|
16
20
|
self.class.exception_name = "#{args['exception']} from #{config}"
|
17
21
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
|
23
|
+
return unless args['backtrace']
|
24
|
+
|
25
|
+
@backtrace = if args['backtrace'].is_a?(String)
|
26
|
+
args['backtrace'].split("\n") # TODO: change cuke4nuke to pass an array instead of a big string
|
27
|
+
else
|
28
|
+
args['backtrace']
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
def backtrace
|
data/lib/cucumber/wire/plugin.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'cucumber/wire/request_handler'
|
3
4
|
require 'cucumber/wire/step_argument'
|
4
5
|
|
@@ -10,7 +11,7 @@ module Cucumber
|
|
10
11
|
def execute(name_to_match)
|
11
12
|
@name_to_match = name_to_match
|
12
13
|
request_params = {
|
13
|
-
:
|
14
|
+
name_to_match: name_to_match
|
14
15
|
}
|
15
16
|
super(request_params)
|
16
17
|
end
|
@@ -21,7 +22,7 @@ module Cucumber
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
alias
|
25
|
+
alias handle_step_matches handle_success
|
25
26
|
|
26
27
|
private
|
27
28
|
|
@@ -41,9 +42,9 @@ module Cucumber
|
|
41
42
|
class SnippetText < RequestHandler
|
42
43
|
def execute(step_keyword, step_name, multiline_arg_class_name)
|
43
44
|
request_params = {
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
45
|
+
step_keyword: step_keyword,
|
46
|
+
step_name: step_name,
|
47
|
+
multiline_arg_class: multiline_arg_class_name
|
47
48
|
}
|
48
49
|
super(request_params)
|
49
50
|
end
|
@@ -52,20 +53,20 @@ module Cucumber
|
|
52
53
|
snippet_text
|
53
54
|
end
|
54
55
|
|
55
|
-
alias
|
56
|
+
alias handle_snippet_text handle_success
|
56
57
|
end
|
57
58
|
|
58
59
|
class Invoke < RequestHandler
|
59
60
|
def execute(step_definition_id, args)
|
60
61
|
request_params = {
|
61
|
-
:
|
62
|
-
:
|
62
|
+
id: step_definition_id,
|
63
|
+
args: args
|
63
64
|
}
|
64
65
|
super(request_params)
|
65
66
|
end
|
66
67
|
|
67
68
|
def handle_pending(message)
|
68
|
-
raise Pending, message ||
|
69
|
+
raise Pending, message || 'TODO'
|
69
70
|
end
|
70
71
|
|
71
72
|
def handle_diff!(tables)
|
@@ -83,7 +84,7 @@ module Cucumber
|
|
83
84
|
@connection.diff_ok
|
84
85
|
end
|
85
86
|
|
86
|
-
alias
|
87
|
+
alias handle_step_failed handle_fail
|
87
88
|
|
88
89
|
private
|
89
90
|
|
@@ -93,11 +94,11 @@ module Cucumber
|
|
93
94
|
end
|
94
95
|
|
95
96
|
class DiffFailed < RequestHandler
|
96
|
-
alias
|
97
|
+
alias handle_step_failed handle_fail
|
97
98
|
end
|
98
99
|
|
99
100
|
class DiffOk < RequestHandler
|
100
|
-
alias
|
101
|
+
alias handle_step_failed handle_fail
|
101
102
|
end
|
102
103
|
|
103
104
|
class HookRequestHandler < RequestHandler
|
@@ -105,11 +106,22 @@ module Cucumber
|
|
105
106
|
super(request_params(test_case))
|
106
107
|
end
|
107
108
|
|
109
|
+
def method_missing(name, *args, &block)
|
110
|
+
# TODO: Hard-code this until Ruby 3.4 is a minimum then this can be removed
|
111
|
+
raise NoMethodError, "Undefined method '#{name}' for #{self.class}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def respond_to_missing?(name, include_private = false)
|
115
|
+
# TODO: Remove this once ruby 3.4 is the minimum
|
116
|
+
super
|
117
|
+
end
|
118
|
+
|
108
119
|
private
|
109
120
|
|
110
121
|
def request_params(test_case)
|
111
122
|
return nil unless test_case.tags.any?
|
112
|
-
|
123
|
+
|
124
|
+
{ 'tags' => clean_tag_names(test_case.tags) }
|
113
125
|
end
|
114
126
|
|
115
127
|
def clean_tag_names(tags)
|
@@ -120,7 +132,6 @@ module Cucumber
|
|
120
132
|
BeginScenario = Class.new(HookRequestHandler)
|
121
133
|
|
122
134
|
EndScenario = Class.new(HookRequestHandler)
|
123
|
-
|
124
135
|
end
|
125
136
|
end
|
126
137
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Wire
|
3
5
|
class RequestHandler
|
@@ -15,18 +17,19 @@ module Cucumber
|
|
15
17
|
raise @connection.exception(params)
|
16
18
|
end
|
17
19
|
|
18
|
-
def handle_success(params)
|
19
|
-
end
|
20
|
+
def handle_success(params); end
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
24
|
# Props to Rails
|
24
25
|
def underscore(camel_cased_word)
|
25
|
-
camel_cased_word
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
camel_cased_word
|
27
|
+
.to_s
|
28
|
+
.gsub('::', '/')
|
29
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
30
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
31
|
+
.tr('-', '_')
|
32
|
+
.downcase
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Wire
|
3
5
|
module Snippet
|
@@ -7,22 +9,22 @@ module Cucumber
|
|
7
9
|
@connections = connections
|
8
10
|
end
|
9
11
|
|
10
|
-
def call(code_keyword, step_name, multiline_arg,
|
12
|
+
def call(code_keyword, step_name, multiline_arg, _snippet_type)
|
11
13
|
@connections.snippets(code_keyword, step_name, MultilineArgClassName.new(multiline_arg).to_s).join("\n")
|
12
14
|
end
|
13
15
|
|
14
16
|
class MultilineArgClassName
|
15
17
|
def initialize(arg)
|
16
18
|
arg.describe_to(self)
|
17
|
-
@result =
|
19
|
+
@result = ''
|
18
20
|
end
|
19
21
|
|
20
22
|
def data_table(*)
|
21
|
-
@result =
|
23
|
+
@result = 'Cucumber::MultilineArgument::DataTable'
|
22
24
|
end
|
23
25
|
|
24
26
|
def doc_string(*)
|
25
|
-
@result =
|
27
|
+
@result = 'Cucumber::MultilineArgument::DocString'
|
26
28
|
end
|
27
29
|
|
28
30
|
def to_s
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'cucumber/cucumber_expressions/group'
|
3
4
|
|
4
5
|
module Cucumber
|
@@ -9,7 +10,8 @@ module Cucumber
|
|
9
10
|
attr_reader :offset
|
10
11
|
|
11
12
|
def initialize(offset, val)
|
12
|
-
@offset
|
13
|
+
@offset = offset
|
14
|
+
@value = val
|
13
15
|
end
|
14
16
|
|
15
17
|
def value(_current_world)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cucumber/core/test/location'
|
2
4
|
|
3
5
|
module Cucumber
|
@@ -7,17 +9,20 @@ module Cucumber
|
|
7
9
|
|
8
10
|
def initialize(connection, data, registry)
|
9
11
|
@connection = connection
|
10
|
-
@registry
|
11
|
-
@id
|
12
|
-
@regexp_source
|
13
|
-
|
14
|
-
|
12
|
+
@registry = registry
|
13
|
+
@id = data['id']
|
14
|
+
@regexp_source = begin
|
15
|
+
Regexp.new(data['regexp'])
|
16
|
+
rescue StandardError
|
17
|
+
data['regexp'] || 'Unknown'
|
18
|
+
end
|
19
|
+
@expression = registry.create_expression(@regexp_source)
|
20
|
+
@location = Core::Test::Location.from_file_colon_line(data['source'] || 'unknown:0')
|
15
21
|
end
|
16
22
|
|
17
23
|
def invoke(args)
|
18
24
|
@connection.invoke(@id, args)
|
19
25
|
end
|
20
|
-
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
data/lib/cucumber/wire.rb
CHANGED
metadata
CHANGED
@@ -1,135 +1,189 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-wire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wynne
|
8
|
-
|
8
|
+
- Aurelien Reeves
|
9
|
+
- Luke Hill
|
10
|
+
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2025-10-14 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: cucumber-core
|
15
17
|
requirement: !ruby/object:Gem::Requirement
|
16
18
|
requirements:
|
17
|
-
- - "
|
19
|
+
- - ">"
|
18
20
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
- - "
|
21
|
+
version: '11'
|
22
|
+
- - "<"
|
21
23
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
24
|
+
version: '16'
|
23
25
|
type: :runtime
|
24
26
|
prerelease: false
|
25
27
|
version_requirements: !ruby/object:Gem::Requirement
|
26
28
|
requirements:
|
27
|
-
- - "
|
29
|
+
- - ">"
|
28
30
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- - "
|
31
|
+
version: '11'
|
32
|
+
- - "<"
|
31
33
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
34
|
+
version: '16'
|
33
35
|
- !ruby/object:Gem::Dependency
|
34
36
|
name: cucumber-cucumber-expressions
|
35
37
|
requirement: !ruby/object:Gem::Requirement
|
36
38
|
requirements:
|
37
|
-
- - "
|
39
|
+
- - ">"
|
38
40
|
- !ruby/object:Gem::Version
|
39
|
-
version: '14
|
40
|
-
- - "
|
41
|
+
version: '14'
|
42
|
+
- - "<"
|
41
43
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
44
|
+
version: '20'
|
43
45
|
type: :runtime
|
44
46
|
prerelease: false
|
45
47
|
version_requirements: !ruby/object:Gem::Requirement
|
46
48
|
requirements:
|
47
|
-
- - "
|
49
|
+
- - ">"
|
48
50
|
- !ruby/object:Gem::Version
|
49
|
-
version: '14
|
50
|
-
- - "
|
51
|
+
version: '14'
|
52
|
+
- - "<"
|
51
53
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
54
|
+
version: '20'
|
53
55
|
- !ruby/object:Gem::Dependency
|
54
56
|
name: aruba
|
55
57
|
requirement: !ruby/object:Gem::Requirement
|
56
58
|
requirements:
|
57
59
|
- - "~>"
|
58
60
|
- !ruby/object:Gem::Version
|
59
|
-
version: '2.
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.0.0
|
61
|
+
version: '2.2'
|
63
62
|
type: :development
|
64
63
|
prerelease: false
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
66
65
|
requirements:
|
67
66
|
- - "~>"
|
68
67
|
- !ruby/object:Gem::Version
|
69
|
-
version: '2.
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 2.0.0
|
68
|
+
version: '2.2'
|
73
69
|
- !ruby/object:Gem::Dependency
|
74
70
|
name: cucumber
|
75
71
|
requirement: !ruby/object:Gem::Requirement
|
76
72
|
requirements:
|
77
|
-
- - "
|
73
|
+
- - ">"
|
78
74
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
80
|
-
- - "
|
75
|
+
version: '8'
|
76
|
+
- - "<"
|
81
77
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
78
|
+
version: '11'
|
83
79
|
type: :development
|
84
80
|
prerelease: false
|
85
81
|
version_requirements: !ruby/object:Gem::Requirement
|
86
82
|
requirements:
|
87
|
-
- - "
|
83
|
+
- - ">"
|
88
84
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
90
|
-
- - "
|
85
|
+
version: '8'
|
86
|
+
- - "<"
|
91
87
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
88
|
+
version: '11'
|
93
89
|
- !ruby/object:Gem::Dependency
|
94
90
|
name: rake
|
95
91
|
requirement: !ruby/object:Gem::Requirement
|
96
92
|
requirements:
|
97
93
|
- - "~>"
|
98
94
|
- !ruby/object:Gem::Version
|
99
|
-
version: '13.
|
100
|
-
|
95
|
+
version: '13.3'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 13.
|
102
|
+
version: '13.3'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: rspec
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.13'
|
103
110
|
type: :development
|
104
111
|
prerelease: false
|
105
112
|
version_requirements: !ruby/object:Gem::Requirement
|
106
113
|
requirements:
|
107
114
|
- - "~>"
|
108
115
|
- !ruby/object:Gem::Version
|
109
|
-
version: '13
|
110
|
-
|
116
|
+
version: '3.13'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rubocop
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
111
122
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
123
|
+
version: 1.81.0
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 1.81.0
|
113
131
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
132
|
+
name: rubocop-packaging
|
115
133
|
requirement: !ruby/object:Gem::Requirement
|
116
134
|
requirements:
|
117
135
|
- - "~>"
|
118
136
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
120
|
-
|
137
|
+
version: 0.6.0
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 0.6.0
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rubocop-performance
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 1.26.0
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
121
157
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
158
|
+
version: 1.26.0
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: rubocop-rake
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - "~>"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 0.7.1
|
123
166
|
type: :development
|
124
167
|
prerelease: false
|
125
168
|
version_requirements: !ruby/object:Gem::Requirement
|
126
169
|
requirements:
|
127
170
|
- - "~>"
|
128
171
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
130
|
-
|
172
|
+
version: 0.7.1
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: rubocop-rspec
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 3.7.0
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - "~>"
|
131
185
|
- !ruby/object:Gem::Version
|
132
|
-
version: 3.
|
186
|
+
version: 3.7.0
|
133
187
|
description: Wire protocol for Cucumber
|
134
188
|
email: cukes@googlegroups.com
|
135
189
|
executables: []
|
@@ -137,7 +191,6 @@ extensions: []
|
|
137
191
|
extra_rdoc_files: []
|
138
192
|
files:
|
139
193
|
- CHANGELOG.md
|
140
|
-
- CONTRIBUTING.md
|
141
194
|
- LICENSE
|
142
195
|
- README.md
|
143
196
|
- lib/cucumber/wire.rb
|
@@ -154,17 +207,11 @@ files:
|
|
154
207
|
- lib/cucumber/wire/snippet.rb
|
155
208
|
- lib/cucumber/wire/step_argument.rb
|
156
209
|
- lib/cucumber/wire/step_definition.rb
|
157
|
-
- lib/cucumber/wire/version
|
158
|
-
- spec/cucumber/wire/configuration_spec.rb
|
159
|
-
- spec/cucumber/wire/connection_spec.rb
|
160
|
-
- spec/cucumber/wire/connections_spec.rb
|
161
|
-
- spec/cucumber/wire/data_packet_spec.rb
|
162
|
-
- spec/cucumber/wire/exception_spec.rb
|
163
210
|
homepage: http://cucumber.io
|
164
211
|
licenses:
|
165
212
|
- MIT
|
166
213
|
metadata: {}
|
167
|
-
post_install_message:
|
214
|
+
post_install_message:
|
168
215
|
rdoc_options:
|
169
216
|
- "--charset=UTF-8"
|
170
217
|
require_paths:
|
@@ -173,20 +220,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
173
220
|
requirements:
|
174
221
|
- - ">="
|
175
222
|
- !ruby/object:Gem::Version
|
176
|
-
version: '
|
223
|
+
version: '3.1'
|
177
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
225
|
requirements:
|
179
226
|
- - ">="
|
180
227
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
228
|
+
version: 3.2.8
|
182
229
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
184
|
-
signing_key:
|
230
|
+
rubygems_version: 3.4.20
|
231
|
+
signing_key:
|
185
232
|
specification_version: 4
|
186
|
-
summary: cucumber-wire-
|
187
|
-
test_files:
|
188
|
-
- spec/cucumber/wire/configuration_spec.rb
|
189
|
-
- spec/cucumber/wire/connections_spec.rb
|
190
|
-
- spec/cucumber/wire/connection_spec.rb
|
191
|
-
- spec/cucumber/wire/data_packet_spec.rb
|
192
|
-
- spec/cucumber/wire/exception_spec.rb
|
233
|
+
summary: cucumber-wire-8.0.0
|
234
|
+
test_files: []
|
data/CONTRIBUTING.md
DELETED
data/lib/cucumber/wire/version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
6.2.1
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'cucumber/wire/configuration'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Wire
|
6
|
-
describe Configuration do
|
7
|
-
let(:wire_file) { Tempfile.new('wire') }
|
8
|
-
let(:config) { Configuration.from_file(wire_file.path) }
|
9
|
-
|
10
|
-
def write_wire_file(contents)
|
11
|
-
wire_file << contents
|
12
|
-
wire_file.close
|
13
|
-
end
|
14
|
-
|
15
|
-
it "reads the hostname / port from the file" do
|
16
|
-
write_wire_file %q{
|
17
|
-
host: localhost
|
18
|
-
port: 54321
|
19
|
-
}
|
20
|
-
|
21
|
-
expect(config.host).to eq 'localhost'
|
22
|
-
expect(config.port).to eq 54321
|
23
|
-
end
|
24
|
-
|
25
|
-
it "reads the timeout for a specific message" do
|
26
|
-
write_wire_file %q{
|
27
|
-
host: localhost
|
28
|
-
port: 54321
|
29
|
-
timeout:
|
30
|
-
invoke: 99
|
31
|
-
}
|
32
|
-
|
33
|
-
expect(config.timeout('invoke')).to eq 99
|
34
|
-
end
|
35
|
-
|
36
|
-
it "reads the timeout for a connect message" do
|
37
|
-
write_wire_file %q{
|
38
|
-
host: localhost
|
39
|
-
port: 54321
|
40
|
-
timeout:
|
41
|
-
connect: 99
|
42
|
-
}
|
43
|
-
|
44
|
-
expect(config.timeout('connect')).to eq 99
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "a wire file with no timeouts specified" do
|
48
|
-
before(:each) do
|
49
|
-
write_wire_file %q{
|
50
|
-
host: localhost
|
51
|
-
port: 54321
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
%w(invoke begin_scenario end_scenario).each do |message|
|
56
|
-
it "sets the default timeout for '#{message}' to 120 seconds" do
|
57
|
-
expect(config.timeout(message)).to eq 120
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'cucumber/wire/connection'
|
2
|
-
require 'cucumber/wire/configuration'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Wire
|
6
|
-
describe Connection do
|
7
|
-
class TestConnection < Connection
|
8
|
-
attr_accessor :socket
|
9
|
-
end
|
10
|
-
|
11
|
-
class TestConfiguration
|
12
|
-
attr_reader :custom_timeout
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@custom_timeout = {}
|
16
|
-
end
|
17
|
-
|
18
|
-
def timeout(message = nil)
|
19
|
-
return :default_timeout if message.nil?
|
20
|
-
@custom_timeout[message] || Configuration::DEFAULT_TIMEOUTS.fetch(message)
|
21
|
-
end
|
22
|
-
|
23
|
-
def host
|
24
|
-
'localhost'
|
25
|
-
end
|
26
|
-
|
27
|
-
def port
|
28
|
-
'3902'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
before(:each) do
|
33
|
-
@config = TestConfiguration.new
|
34
|
-
@connection = TestConnection.new(@config)
|
35
|
-
@connection.socket = @socket = double('socket').as_null_object
|
36
|
-
@response = %q{["response"]}
|
37
|
-
end
|
38
|
-
|
39
|
-
it "re-raises a timeout error" do
|
40
|
-
allow(Timeout).to receive(:timeout).and_raise(Timeout::Error.new(''))
|
41
|
-
expect(-> { @connection.call_remote(nil, :foo, []) }).to raise_error(Timeout::Error)
|
42
|
-
end
|
43
|
-
|
44
|
-
it "ignores timeout errors when configured to do so" do
|
45
|
-
@config.custom_timeout[:foo] = :never
|
46
|
-
|
47
|
-
allow(@socket).to receive(:gets) { @response }
|
48
|
-
|
49
|
-
handler = double(:handle_response => :response)
|
50
|
-
|
51
|
-
expect(@connection.call_remote(handler, :foo, [])).to eq :response
|
52
|
-
end
|
53
|
-
|
54
|
-
it "raises an exception on remote connection closed" do
|
55
|
-
@config.custom_timeout[:foo] = :never
|
56
|
-
|
57
|
-
allow(@socket).to receive(:gets)
|
58
|
-
expect(-> {
|
59
|
-
@connection.call_remote(nil, :foo, [])
|
60
|
-
}).to raise_error(Wire::Exception, 'Remote Socket with localhost:3902 closed.')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'cucumber/wire/connections'
|
2
|
-
require 'cucumber/wire/configuration'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Wire
|
6
|
-
describe Connections do
|
7
|
-
describe "#step_matches" do
|
8
|
-
it "returns the matches from each of the RemoteSteps" do
|
9
|
-
connection1 = double(step_matches: [:a, :b])
|
10
|
-
connection2 = double(step_matches: [:c])
|
11
|
-
|
12
|
-
connections = Connections.new([connection1, connection2], double, double)
|
13
|
-
expect(connections.step_matches('')).to eq [:a, :b, :c]
|
14
|
-
end
|
15
|
-
|
16
|
-
it "copes with no connections" do
|
17
|
-
connections = Connections.new([], double, double)
|
18
|
-
expect(connections.step_matches('')).to eq []
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'cucumber/wire/data_packet'
|
2
|
-
|
3
|
-
module Cucumber
|
4
|
-
module Wire
|
5
|
-
describe DataPacket do
|
6
|
-
describe "#to_json" do
|
7
|
-
it "converts params to a JSON hash" do
|
8
|
-
packet = DataPacket.new('test_message', :foo => :bar)
|
9
|
-
|
10
|
-
expect(packet.to_json).to eq "[\"test_message\",{\"foo\":\"bar\"}]"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "does not pass blank params" do
|
14
|
-
packet = DataPacket.new('test_message')
|
15
|
-
|
16
|
-
expect(packet.to_json).to eq "[\"test_message\"]"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe ".parse" do
|
21
|
-
it "understands a raw packet containing null parameters" do
|
22
|
-
packet = DataPacket.parse("[\"test_message\",null]")
|
23
|
-
|
24
|
-
expect(packet.message).to eq 'test_message'
|
25
|
-
expect(packet.params).to be_nil
|
26
|
-
end
|
27
|
-
|
28
|
-
it "understands a raw packet containing no parameters" do
|
29
|
-
packet = DataPacket.parse("[\"test_message\"]")
|
30
|
-
|
31
|
-
expect(packet.message).to eq 'test_message'
|
32
|
-
expect(packet.params).to be_nil
|
33
|
-
end
|
34
|
-
|
35
|
-
it "understands a raw packet containging parameters data" do
|
36
|
-
packet = DataPacket.parse("[\"test_message\",{\"foo\":\"bar\"}]")
|
37
|
-
|
38
|
-
expect(packet.params['foo']).to eq 'bar'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'cucumber/wire/exception'
|
2
|
-
require 'cucumber/wire/configuration'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Wire
|
6
|
-
describe Exception do
|
7
|
-
before(:each) do
|
8
|
-
@config = Configuration.new('host' => 'localhost', 'port' => 54321)
|
9
|
-
end
|
10
|
-
|
11
|
-
def exception
|
12
|
-
Wire::Exception.new(@data, @config)
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "with just a message" do
|
16
|
-
before(:each) do
|
17
|
-
@data = {'message' => 'foo'}
|
18
|
-
end
|
19
|
-
|
20
|
-
it "#to_s as expecteds" do
|
21
|
-
expect(exception.to_s).to eq "foo"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "with a message and an exception" do
|
26
|
-
before(:each) do
|
27
|
-
@data = {'message' => 'foo', 'exception' => 'Bar'}
|
28
|
-
end
|
29
|
-
|
30
|
-
it "#to_s as expecteds" do
|
31
|
-
expect(exception.to_s).to eq "foo"
|
32
|
-
end
|
33
|
-
|
34
|
-
it "#class.to_s returns the name of the exception" do
|
35
|
-
expect(exception.class.to_s).to eq 'Bar from localhost:54321'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "with a custom backtrace" do
|
40
|
-
before(:each) do
|
41
|
-
@data = {'message' => 'foo', 'backtrace' => ['foo', 'bar', 'baz']}
|
42
|
-
end
|
43
|
-
|
44
|
-
it "#backrace returns the custom backtrace" do
|
45
|
-
expect(exception.backtrace).to eq ['foo', 'bar', 'baz']
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|