Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ruby/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Gemfile.lock
*.gem
2 changes: 2 additions & 0 deletions ruby/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require spec_helper
--color
21 changes: 21 additions & 0 deletions ruby/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
inherit_from: .rubocop_todo.yml

plugins:
- rubocop-performance
- rubocop-rspec

inherit_mode:
merge:
- Exclude

AllCops:
TargetRubyVersion: 3.2
NewCops: enable

# Stylistic preference for cucumber
Gemspec/DevelopmentDependencies:
Enabled: false

# Disabled on our repo's to enable polyglot-release
Gemspec/RequireMFA:
Enabled: false
128 changes: 128 additions & 0 deletions ruby/.rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2025-09-05 19:34:38 UTC using RuboCop version 1.80.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
Layout/EmptyLinesAroundModuleBody:
Exclude:
- 'spec/support/runner_helper.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'spec/cucumber/query/legacy/step_definitions_by_test_step_spec.rb'

# Offense count: 8
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'spec/cucumber/query/legacy/hook_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/step_definitions_by_test_step_spec.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
# NotImplementedExceptions: NotImplementedError
Lint/UnusedMethodArgument:
Exclude:
- 'lib/cucumber/query/query.rb'

# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 43

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 14

# Offense count: 3
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 24

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 14

# Offense count: 8
Performance/MethodObjectAsBlock:
Exclude:
- 'lib/cucumber/query/legacy/hook_by_test_step.rb'
- 'lib/cucumber/query/legacy/pickle_by_test.rb'
- 'lib/cucumber/query/legacy/pickle_step_by_test_step.rb'
- 'lib/cucumber/query/legacy/step_definitions_by_test_step.rb'
- 'lib/cucumber/query/legacy/test_case_started_by_test_case.rb'

# Offense count: 1
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/cucumber/query/legacy/hook_by_test_step_spec.rb'

# Offense count: 1
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 7

# Offense count: 32
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/cucumber/query/legacy/hook_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/pickle_by_test_spec.rb'
- 'spec/cucumber/query/legacy/pickle_step_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/step_definitions_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/test_case_started_by_test_case_spec.rb'

# Offense count: 3
RSpec/MultipleExpectations:
Max: 3

# Offense count: 12
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 5

# Offense count: 8
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'lib/cucumber/query/helpers.rb'
- 'lib/cucumber/query/legacy/hook_by_test_step.rb'
- 'lib/cucumber/query/legacy/pickle_by_test.rb'
- 'lib/cucumber/query/legacy/pickle_step_by_test_step.rb'
- 'lib/cucumber/query/legacy/step_definitions_by_test_step.rb'
- 'lib/cucumber/query/legacy/test_case_started_by_test_case.rb'
- 'lib/cucumber/query/legacy/test_run_started.rb'
- 'lib/cucumber/query/query.rb'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'lib/cucumber/query/helpers.rb'
- 'lib/cucumber/query/query.rb'
- 'spec/support/gherkin_helper.rb'
- 'spec/support/runner_helper.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 198
5 changes: 5 additions & 0 deletions ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
112 changes: 112 additions & 0 deletions ruby/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
PATH
remote: .
specs:
cucumber-query (21.0.0)
cucumber-messages (> 25, < 30)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.3.0)
bigdecimal (3.2.3)
builder (3.3.0)
cucumber (10.1.0)
base64 (~> 0.2)
builder (~> 3.2)
cucumber-ci-environment (> 9, < 11)
cucumber-core (> 15, < 17)
cucumber-cucumber-expressions (> 17, < 19)
cucumber-html-formatter (> 20.3, < 22)
diff-lcs (~> 1.5)
logger (~> 1.6)
mini_mime (~> 1.1)
multi_test (~> 1.1)
sys-uname (~> 1.3)
cucumber-ci-environment (10.0.1)
cucumber-core (15.2.1)
cucumber-gherkin (> 27, < 33)
cucumber-messages (> 26, < 30)
cucumber-tag-expressions (> 5, < 7)
cucumber-cucumber-expressions (18.0.1)
bigdecimal
cucumber-gherkin (32.2.0)
cucumber-messages (> 25, < 28)
cucumber-html-formatter (21.14.0)
cucumber-messages (> 19, < 28)
cucumber-messages (27.2.0)
cucumber-tag-expressions (6.1.2)
diff-lcs (1.5.1)
ffi (1.17.2)
ffi (1.17.2-x86_64-linux-gnu)
json (2.9.1)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.7.0)
memoist3 (1.0.0)
mini_mime (1.1.5)
multi_test (1.1.0)
parallel (1.26.3)
parser (3.3.9.0)
ast (~> 2.4.1)
racc
prism (1.4.0)
racc (1.8.1)
rainbow (3.1.1)
regexp_parser (2.10.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rubocop (1.80.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.46.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.46.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.25.0)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rspec (3.7.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
ruby-progressbar (1.13.0)
sys-uname (1.4.1)
ffi (~> 1.1)
memoist3 (~> 1.0.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
cucumber (~> 10.1)
cucumber-query!
rspec (~> 3.13)
rubocop (~> 1.80.0)
rubocop-performance (~> 1.25.0)
rubocop-rspec (~> 3.7.0)

BUNDLED WITH
2.6.2
21 changes: 21 additions & 0 deletions ruby/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Cucumber Ltd and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
81 changes: 81 additions & 0 deletions ruby/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# The Cucumber Compatibility Kit for Ruby

The CCK - aka. Cucumber Compatibility Kit - is a set of features and Messages.
It aims to validate an implementation of the
[Cucumber Messages protocol](https://github.com/cucumber/common/tree/main/messages#cucumber-messages).

## Overview

This kit (gem), consists of a set of features, miscellaneous files and messages:

- Each area will contain one feature, which, once executed, will emit an exhaustive set of messages
as specified by the protocol
- Some of these areas may "also" require miscellaneous files to be used when testing functions
such as attaching images or documents or reading data from files
- Each area will contain a set of messages - serialized as a single `.ndjson` file
This is the reference for the CCK, that a given feature from the kit, when executed using any dedicated
step definitions, must emit the **exact** corresponding messages

## Installation and Usage

Add `cucumber-compatibility-kit` to your `Gemfile` as a development dependency, and
install it:

bundle install

Then add a spec that could look like this:

```ruby
# spec/my_compatibility_checks_spec.rb
require 'cucumber/compatibility_kit'

describe Cucumber::CompatibilityKit, type: :feature do
let(:cucumber_command) { 'bundle exec cucumber --publish-quiet --profile none --format message' }

# Don't run the retry or skipped CCK Examples (For whatever reason)
examples = Cucumber::CompatibilityKit.gherkin.reject { |example| example == 'retry' || example == 'skipped' }

examples.each do |example_name|
describe "'#{example_name}' example" do
include_examples 'cucumber compatibility kit' do
let(:example) { example_name }
# You will need to specify the relative support code and cck paths
let(:messages) { `#{cucumber_command} --require #{support_code_path} #{cck_path}` }
end
end
end
end
```

`CucumberCompatibilityKit.gherkin` will return an array that lists all the gherkin examples available within the CCK.
Here, we want to execute all of them except the `retry` and `skipped` ones (For whatever reason).

`let(:messages)` will execute the cucumber command. As we are using the `message` formatter, `messages` will
then contain the messages as a `ndjson` document with one message per line.

You can use `gem open cucumber-compatibility-kit` in order to take a look at the features and the
expected messages they should produce. They are available in the `features` folder within the gem.

## More info

The Cucumber Compatibility Kit is part of the development tools of [Cucumber](https://cucumber.io).
It allows us to make sure that all our implementations are properly supporting our internal protocol
and thus are compatible (and consistent), with each other and our common tools like the [html-formatter](https://github.com/cucumber/html-formatter).

It can be a valuable tool if you are developing integration with cucumber, or your own implementation of it.

Join us on [github/cucumber/compatibility-kit](https://github.com/cucumber/compatibility-kit)
to get more help if you need to.

You can also take a look on [cucumber-ruby](https://github.com/cucumber/cucumber-ruby/blob/v9.2.0/compatibility/cck_spec.rb)
to see how the kit is used there.

## Development

Before building this project locally, the samples must be copied from the `devkit`. Use:

```
cd ../devkit
npm ci && npm run copy-to:ruby
cd ../ruby
```
1 change: 1 addition & 0 deletions ruby/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21.0.0
Loading
Loading