cucumber-wire 0.0.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 193ced89d633c8b78eee1a626af39e9f69a2dbc5
4
- data.tar.gz: 42c38717dab358471f86f3f1085c186c2e9df3a6
2
+ SHA256:
3
+ metadata.gz: 75471bc4f5662b423d400b2cd105d7cdcce04ded55cf82773e72885647d03f00
4
+ data.tar.gz: 032db46bd8e08ee87a2744f083ac99ac50e745960709d93c354e21951ef3fb9e
5
5
  SHA512:
6
- metadata.gz: d48ac504abae09629fd5baca0dd4b1ef8488623b5da662a1cdfc7b2e8a1808420845f51d1a990def3ee625f211834236814d21f6aa9311d810a0b406031ed343
7
- data.tar.gz: b131fcc0318fd1cadec22641e8fac0ab9575db479711a708508c2282b7ba73c2df7859ee3653285364f66daaccf97382dae3dfabc0bf1be1ca306f89ef9a742c
6
+ metadata.gz: 94b13b0ee96d03f9d9c42671411209579807477c2945f9c5602f9a96f25f17647af1e7b89df2732af54370721b40230b642a21ec34f2b30e89753d1836942a34
7
+ data.tar.gz: 16dd72d0f9c9c2db7da35b600d5ef981fc00e29efb1fc07fa54ff2b3cb940a0aa34b311a86675b65560d49dc059c5179983ae4d1676da595ec1f445189a5e14f
@@ -1,9 +1,13 @@
1
1
  rvm:
2
+ - ruby-head
3
+ - 2.4.0
4
+ - 2.3.3
2
5
  - 2.2
3
- - 2.1
4
- - 2.0
5
- - 1.9.3
6
- - jruby-1.7.12
6
+
7
+ matrix:
8
+ allow_failures:
9
+ - rvm: ruby-head
10
+ fast_finish: true
7
11
 
8
12
  # whitelist
9
13
  branches:
@@ -0,0 +1,39 @@
1
+ # CHANGE LOG
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ This project adheres to [Semantic Versioning](http://semver.org).
6
+
7
+ This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com).
8
+
9
+ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber.
10
+
11
+ ----
12
+
13
+ ## [In Git](https://github.com/cucumber/cucumber-ruby-wire/compare/v1.0.0...master)
14
+
15
+ ### Removed
16
+
17
+ ### Added
18
+
19
+ ### Changed
20
+
21
+ ### Fixed
22
+
23
+ ## [1.0.0](https://github.com/cucumber/cucumber-ruby-wire/compare/v0.0.1...v1.0.0)
24
+
25
+ ### Added
26
+
27
+ * 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))
28
+
29
+ ### Changed
30
+
31
+ * Changes to work with a modern Cucumber-Ruby ([#14](https://github.com/cucumber/cucumber-ruby-wire/pull/14) [brasmusson](https://github.com/brasmusson))
32
+ * 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))
33
+
34
+ <!-- Contributors -->
35
+ [brasmusson]: https://github.com/brasmusson
36
+ [jaysonesmith]: https://github.com/jaysonesmith
37
+ [junaruga]: https://github.com/junaruga
38
+ [mattwynne]: https://github.com/mattwynne
39
+ [olleolleolle]: https://github.com/olleolleolle
@@ -0,0 +1,14 @@
1
+ Release Process
2
+ ===============
3
+
4
+ * Bump the version number in `lib/cucumber/wire/version`
5
+ * Update `CHANGELOG.md` with the upcoming version number and create a new `In Git` section
6
+ * Now release it:
7
+
8
+ ```
9
+ bundle update
10
+ bundle exec rake
11
+ git commit -m "Release X.Y.Z"
12
+ # Make sure you run gem signin as the cukebot@cucumber.io user before running the following step. Credentials can be found in 1Password
13
+ rake release
14
+ ```
data/Gemfile CHANGED
@@ -5,9 +5,9 @@ unless ENV['CUCUMBER_USE_RELEASED_GEMS']
5
5
  # cucumber gem
6
6
  cucumber_path = File.expand_path("../../cucumber-ruby", __FILE__)
7
7
  if File.exist?(cucumber_path) && !ENV['CUCUMBER_USE_GIT']
8
- gem "cucumber", path: cucumber_path, branch: "remove-wire-protocol-to-plugin"
8
+ gem "cucumber", path: cucumber_path
9
9
  else
10
- gem "cucumber", :git => "git://github.com/cucumber/cucumber-ruby.git", branch: "remove-wire-protocol-to-plugin"
10
+ gem "cucumber", :git => "git://github.com/cucumber/cucumber-ruby.git"
11
11
  end
12
12
 
13
13
  # cucumber-core gem
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2015 Cucumber Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1 +1,3 @@
1
- Work in progress: See https://github.com/cucumber/cucumber-ruby/pull/878
1
+ [![Build Status](https://travis-ci.org/cucumber/cucumber-ruby-wire.svg?branch=master)](https://travis-ci.org/cucumber/cucumber-ruby-wire)
2
+
3
+ # cucumber-wire
@@ -11,9 +11,12 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://cucumber.io"
12
12
  s.platform = Gem::Platform::RUBY
13
13
  s.license = "MIT"
14
- s.required_ruby_version = ">= 1.9.3"
14
+ s.required_ruby_version = ">= 2.2"
15
15
 
16
- s.add_development_dependency 'cucumber', '~> 2.1.0'
16
+ s.add_dependency 'cucumber-core', '~> 4.0'
17
+ s.add_dependency 'cucumber-expressions', '~> 6.0'
18
+
19
+ s.add_development_dependency 'cucumber', '~> 4.0'
17
20
 
18
21
  s.add_development_dependency 'bundler', '>= 1.3.5'
19
22
  s.add_development_dependency 'rake', '>= 0.9.2'
@@ -0,0 +1,39 @@
1
+ Feature: Wire protocol docstrings
2
+
3
+ In order to use docstrings as arguments to step definitions, we send them as
4
+ an additional argument after the arguments extracted by the wire server.
5
+
6
+ Background:
7
+ Given a file named "features/step_definitions/some_remote_place.wire" with:
8
+ """
9
+ host: localhost
10
+ port: 54321
11
+
12
+ """
13
+
14
+ Scenario: Run a scenario
15
+ Given a file named "features/wired.feature" with:
16
+ """
17
+ Feature: High strung
18
+ Scenario: Wired
19
+ Given we're all wired
20
+ \"\"\"
21
+ to want more
22
+ \"\"\"
23
+ """
24
+ And there is a wire server running on port 54321 which understands the following protocol:
25
+ | request | response |
26
+ | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
27
+ | ["begin_scenario"] | ["success"] |
28
+ | ["invoke",{"id":"1","args":["to want more"]}] | ["success"] |
29
+ | ["end_scenario"] | ["success"] |
30
+ When I run `cucumber -f progress`
31
+ Then the stderr should not contain anything
32
+ And it should pass with:
33
+ """
34
+ .
35
+
36
+ 1 scenario (1 passed)
37
+ 1 step (1 passed)
38
+
39
+ """
@@ -47,8 +47,6 @@ Feature: Invoke message
47
47
 
48
48
  Scenario: Wired
49
49
  Given we're all wired
50
- I'll do it later (Cucumber::Pending)
51
- features/wired.feature:3:in `Given we're all wired'
52
50
 
53
51
  1 scenario (1 pending)
54
52
  1 step (1 pending)
@@ -102,7 +100,7 @@ Feature: Invoke message
102
100
  (::) failed steps (::)
103
101
 
104
102
  The wires are down (Some.Foreign.ExceptionType from localhost:54321)
105
- features/wired.feature:3:in `Given we're all wired'
103
+ features/wired.feature:3:in `we're all wired'
106
104
 
107
105
  Failing Scenarios:
108
106
  cucumber features/wired.feature:2 # Scenario: Wired
@@ -70,7 +70,7 @@ Feature: Step matches message
70
70
  """
71
71
  -
72
72
 
73
- we.* # MyApp.MyClass:123
73
+ "we.*" # MyApp.MyClass:123
74
74
 
75
75
  1 scenario (1 skipped)
76
76
  1 step (1 skipped)
@@ -39,7 +39,7 @@ Feature: Wire protocol table diffing
39
39
  Not same (DifferentException from localhost:54321)
40
40
  a.cs:12
41
41
  b.cs:34
42
- features/wired.feature:3:in `Given we're all wired'
42
+ features/wired.feature:3:in `we're all wired'
43
43
 
44
44
  Failing Scenarios:
45
45
  cucumber features/wired.feature:2
@@ -84,7 +84,7 @@ Feature: Wire protocol table diffing
84
84
  (::) failed steps (::)
85
85
 
86
86
  I wanted things to be different for us (Cucumber::Wire::Exception)
87
- features/wired.feature:3:in `Given we're all wired'
87
+ features/wired.feature:3:in `we're all wired'
88
88
 
89
89
  Failing Scenarios:
90
90
  cucumber features/wired.feature:2
@@ -113,7 +113,7 @@ Feature: Wire protocol table diffing
113
113
 
114
114
  | (-) a | (+) b |
115
115
  (Cucumber::MultilineArgument::DataTable::Different)
116
- features/wired.feature:3:in `Given we're all wired'
116
+ features/wired.feature:3:in `we're all wired'
117
117
 
118
118
  Failing Scenarios:
119
119
  cucumber features/wired.feature:2
@@ -52,7 +52,7 @@ Feature: Wire protocol timeouts
52
52
  Scenario: Wired
53
53
  Given we're all wired
54
54
  Timed out calling wire server with message 'invoke' (Timeout::Error)
55
- features/wired.feature:3:in `Given we're all wired'
55
+ features/wired.feature:3:in `we're all wired'
56
56
 
57
57
  Failing Scenarios:
58
58
  cucumber features/wired.feature:2
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  module Cucumber
2
3
  module Wire
3
4
  class AddHooksFilter < Core::Filter.new(:connections)
@@ -10,13 +11,13 @@ module Cucumber
10
11
  def before_hook(test_case)
11
12
  # TODO: is this dependency on Cucumber::Hooks OK? Feels a bit internal..
12
13
  # TODO: how do we express the location of the hook? Should we create one hook per connection so we can use the host:port of the connection?
13
- Cucumber::Hooks.before_hook(test_case.source, Core::Ast::Location.new('TODO:wire')) do
14
+ Cucumber::Hooks.before_hook(Core::Test::Location.new('TODO:wire')) do
14
15
  connections.begin_scenario(test_case)
15
16
  end
16
17
  end
17
18
 
18
19
  def after_hook(test_case)
19
- Cucumber::Hooks.after_hook(test_case.source, Core::Ast::Location.new('TODO:wire')) do
20
+ Cucumber::Hooks.after_hook(Core::Test::Location.new('TODO:wire')) do
20
21
  connections.end_scenario(test_case)
21
22
  end
22
23
  end
@@ -16,10 +16,11 @@ module Cucumber
16
16
  attr_reader :connections
17
17
  private :connections
18
18
 
19
- def initialize(connections, configuration)
19
+ def initialize(connections, configuration, registry)
20
20
  raise ArgumentError unless connections
21
21
  @connections = connections
22
22
  @configuration = configuration
23
+ @registry = registry
23
24
  end
24
25
 
25
26
  def find_match(test_step)
@@ -30,7 +31,7 @@ module Cucumber
30
31
  end
31
32
 
32
33
  def step_matches(step_name)
33
- connections.map{ |c| c.step_matches(step_name)}.flatten
34
+ connections.map{ |c| c.step_matches(step_name, @registry)}.flatten
34
35
  end
35
36
 
36
37
  def begin_scenario(test_case)
@@ -5,15 +5,16 @@ require 'cucumber/step_match_search'
5
5
  module Cucumber
6
6
  module Wire
7
7
  class Plugin
8
- attr_reader :config
9
- private :config
8
+ attr_reader :config, :registry
9
+ private :config, :registry
10
10
 
11
- def initialize(config)
11
+ def initialize(config, registry)
12
12
  @config = config
13
+ @registry = registry
13
14
  end
14
15
 
15
16
  def install
16
- connections = Connections.new(wire_files.map { |f| create_connection(f) }, @config)
17
+ connections = Connections.new(wire_files.map { |f| create_connection(f) }, config, registry)
17
18
  config.filters << Filters::ActivateSteps.new(StepMatchSearch.new(connections.method(:step_matches), @config), @config)
18
19
  config.filters << AddHooksFilter.new(connections) unless @config.dry_run?
19
20
  config.register_snippet_generator Snippet::Generator.new(connections)
@@ -3,8 +3,8 @@ require 'cucumber/wire/protocol/requests'
3
3
  module Cucumber
4
4
  module Wire
5
5
  module Protocol
6
- def step_matches(name_to_match)
7
- handler = Requests::StepMatches.new(self)
6
+ def step_matches(name_to_match, registry)
7
+ handler = Requests::StepMatches.new(self, registry)
8
8
  handler.execute(name_to_match)
9
9
  end
10
10
 
@@ -1,5 +1,6 @@
1
+ # coding: utf-8
1
2
  require 'cucumber/wire/request_handler'
2
- require 'cucumber/step_argument'
3
+ require 'cucumber/wire/step_argument'
3
4
 
4
5
  module Cucumber
5
6
  module Wire
@@ -25,7 +26,7 @@ module Cucumber
25
26
  private
26
27
 
27
28
  def create_step_match(raw_step_match)
28
- step_definition = StepDefinition.new(@connection, raw_step_match)
29
+ step_definition = StepDefinition.new(@connection, raw_step_match, @registry)
29
30
  step_args = raw_step_match['args'].map do |raw_arg|
30
31
  StepArgument.new(raw_arg['pos'], raw_arg['val'])
31
32
  end
@@ -69,7 +70,7 @@ module Cucumber
69
70
 
70
71
  def handle_diff!(tables)
71
72
  # TODO: figure out if / how we could get a location for a table from the wire (or make a null location)
72
- location = Core::Ast::Location.new(__FILE__, __LINE__)
73
+ location = Core::Test::Location.new(__FILE__, __LINE__)
73
74
  table1 = table(tables[0], location)
74
75
  table2 = table(tables[1], location)
75
76
  table1.diff!(table2)
@@ -89,7 +90,7 @@ module Cucumber
89
90
  private
90
91
 
91
92
  def table(data, location)
92
- Cucumber::MultilineArgument.from_core(Core::Ast::DataTable.new(data, location))
93
+ Cucumber::MultilineArgument.from_core(Core::Test::DataTable.new(data, location))
93
94
  end
94
95
  end
95
96
 
@@ -1,9 +1,10 @@
1
1
  module Cucumber
2
2
  module Wire
3
3
  class RequestHandler
4
- def initialize(connection)
4
+ def initialize(connection, registry = nil)
5
5
  @connection = connection
6
6
  @message = underscore(self.class.name.split('::').last)
7
+ @registry = registry
7
8
  end
8
9
 
9
10
  def execute(request_params = nil)
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ require 'cucumber/cucumber_expressions/group'
3
+
4
+ module Cucumber
5
+ module Wire
6
+ # Defines the location and value of a captured argument from the step
7
+ # text
8
+ class StepArgument
9
+ attr_reader :offset
10
+
11
+ def initialize(offset, val)
12
+ @offset, @value = offset, val
13
+ end
14
+
15
+ def value(_current_world)
16
+ @value
17
+ end
18
+
19
+ def group
20
+ CucumberExpressions::Group.new(@value, @offset, @offset + @value.length, [])
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,15 +1,17 @@
1
- require 'cucumber/core/ast/location'
1
+ require 'cucumber/core/test/location'
2
2
 
3
3
  module Cucumber
4
4
  module Wire
5
5
  class StepDefinition
6
- attr_reader :regexp_source, :location
6
+ attr_reader :regexp_source, :location, :registry, :expression
7
7
 
8
- def initialize(connection, data)
8
+ def initialize(connection, data, registry)
9
9
  @connection = connection
10
+ @registry = registry
10
11
  @id = data['id']
11
12
  @regexp_source = data['regexp'] || "Unknown"
12
- @location = Core::Ast::Location.from_file_colon_line(data['source'] || "unknown:0")
13
+ @expression = registry.create_expression(@regexp_source)
14
+ @location = Core::Test::Location.from_file_colon_line(data['source'] || "unknown:0")
13
15
  end
14
16
 
15
17
  def invoke(args)
@@ -1 +1 @@
1
- 0.0.1
1
+ 1.0.0
@@ -9,12 +9,12 @@ module Cucumber
9
9
  connection1 = double(step_matches: [:a, :b])
10
10
  connection2 = double(step_matches: [:c])
11
11
 
12
- connections = Connections.new([connection1, connection2], double)
12
+ connections = Connections.new([connection1, connection2], double, double)
13
13
  expect(connections.step_matches('')).to eq [:a, :b, :c]
14
14
  end
15
15
 
16
16
  it "copes with no connections" do
17
- connections = Connections.new([], double)
17
+ connections = Connections.new([], double, double)
18
18
  expect(connections.step_matches('')).to eq []
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,29 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-wire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wynne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-23 00:00:00.000000000 Z
11
+ date: 2018-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cucumber-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cucumber-expressions
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '6.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '6.0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: cucumber
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
45
  - - "~>"
18
46
  - !ruby/object:Gem::Version
19
- version: 2.1.0
47
+ version: '4.0'
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
52
  - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: 2.1.0
54
+ version: '4.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: bundler
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -88,10 +116,14 @@ extra_rdoc_files: []
88
116
  files:
89
117
  - ".rspec"
90
118
  - ".travis.yml"
119
+ - CHANGELOG.md
120
+ - CONTRIBUTING.md
91
121
  - Gemfile
122
+ - LICENSE
92
123
  - README.md
93
124
  - Rakefile
94
125
  - cucumber-wire.gemspec
126
+ - features/docstring.feature
95
127
  - features/erb_configuration.feature
96
128
  - features/handle_unexpected_response.feature
97
129
  - features/invoke_message.feature
@@ -116,6 +148,7 @@ files:
116
148
  - lib/cucumber/wire/protocol/requests.rb
117
149
  - lib/cucumber/wire/request_handler.rb
118
150
  - lib/cucumber/wire/snippet.rb
151
+ - lib/cucumber/wire/step_argument.rb
119
152
  - lib/cucumber/wire/step_definition.rb
120
153
  - lib/cucumber/wire/version
121
154
  - spec/cucumber/wire/configuration_spec.rb
@@ -136,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
169
  requirements:
137
170
  - - ">="
138
171
  - !ruby/object:Gem::Version
139
- version: 1.9.3
172
+ version: '2.2'
140
173
  required_rubygems_version: !ruby/object:Gem::Requirement
141
174
  requirements:
142
175
  - - ">="
@@ -144,14 +177,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
177
  version: '0'
145
178
  requirements: []
146
179
  rubyforge_project:
147
- rubygems_version: 2.2.2
180
+ rubygems_version: 2.7.4
148
181
  signing_key:
149
182
  specification_version: 4
150
- summary: cucumber-wire-0.0.1
183
+ summary: cucumber-wire-1.0.0
151
184
  test_files:
152
185
  - spec/cucumber/wire/configuration_spec.rb
153
186
  - spec/cucumber/wire/connection_spec.rb
154
187
  - spec/cucumber/wire/connections_spec.rb
155
188
  - spec/cucumber/wire/data_packet_spec.rb
156
189
  - spec/cucumber/wire/exception_spec.rb
157
- has_rdoc: