From 574202c908e0ceb61431e2d033c01bec8badb660 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Wed, 15 Apr 2026 20:39:15 +0100 Subject: [PATCH 1/2] Fix up step spec --- spec/cucumber/core/test/step_spec.rb | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/spec/cucumber/core/test/step_spec.rb b/spec/cucumber/core/test/step_spec.rb index 55a84819..8340ad0c 100644 --- a/spec/cucumber/core/test/step_spec.rb +++ b/spec/cucumber/core/test/step_spec.rb @@ -1,18 +1,18 @@ # frozen_string_literal: true -require 'cucumber/core/test/step' - describe Cucumber::Core::Test::Step do let(:id) { 'some-random-uid' } let(:text) { 'step text' } - let(:location) { double } + let(:location) { { line: 3, column: 5 } } describe 'describing itself' do it 'describes itself to a visitor' do visitor = double args = double test_step = described_class.new(id, text, location) + expect(visitor).to receive(:test_step).with(test_step, args) + test_step.describe_to(visitor, args) end end @@ -35,12 +35,14 @@ args_spy = actual_args end test_step.execute(*expected_args) + expect(args_spy).to eq expected_args end context 'when a passing action exists' do it 'returns a passing result' do test_step = described_class.new(id, text, location).with_action { :no_op } + expect(test_step.execute).to be_passed end end @@ -51,6 +53,7 @@ it 'returns a failing result' do test_step = described_class.new(id, text, location).with_action { raise exception } result = test_step.execute + expect(result).to be_failed expect(result.exception).to eq exception end @@ -60,27 +63,23 @@ it 'returns an Undefined result' do test_step = described_class.new(id, text, location) result = test_step.execute + expect(result).to be_undefined end end end - it 'exposes the text and location of as attributes' do - test_step = described_class.new(id, text, location) - expect(test_step.text).to eq text - expect(test_step.location).to eq location - end - - it 'exposes the location of the action as attribute' do - location = double + it 'exposes the location of the action as attribute as `#action_location`' do action = instance_double(Cucumber::Core::Test::Action::Defined, location: location) - test_step = described_class.new(id, text, location, action) + test_step = described_class.new(id, text, location, :a_blank_multiline_arg, action) + expect(test_step.action_location).to eq(location) end it 'returns the text when converted to a string' do text = 'a passing step' test_step = described_class.new(id, text, location) - expect(test_step.to_s).to eq 'a passing step' + + expect(test_step.to_s).to eq('a passing step') end end From 0bd77be15039552fb51c14d3cb7901307600670c Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Wed, 15 Apr 2026 20:42:07 +0100 Subject: [PATCH 2/2] Tidy up and remove a few redundant requires --- spec/cucumber/core/event_bus_spec.rb | 2 -- spec/cucumber/core/event_spec.rb | 2 -- spec/cucumber/core/report/summary_spec.rb | 1 - spec/cucumber/core/test/case_spec.rb | 2 -- spec/cucumber/core/test/location_spec.rb | 2 -- spec/cucumber/core/test/runner_spec.rb | 2 +- spec/cucumber/core_spec.rb | 1 - 7 files changed, 1 insertion(+), 11 deletions(-) diff --git a/spec/cucumber/core/event_bus_spec.rb b/spec/cucumber/core/event_bus_spec.rb index 57bc6617..6b5995b9 100644 --- a/spec/cucumber/core/event_bus_spec.rb +++ b/spec/cucumber/core/event_bus_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'cucumber/core/event_bus' - module Cucumber module Core module Events diff --git a/spec/cucumber/core/event_spec.rb b/spec/cucumber/core/event_spec.rb index 64a4d8f6..d3979709 100644 --- a/spec/cucumber/core/event_spec.rb +++ b/spec/cucumber/core/event_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'cucumber/core/event' - describe Cucumber::Core::Event do describe '.new' do it 'generates new types of events' do diff --git a/spec/cucumber/core/report/summary_spec.rb b/spec/cucumber/core/report/summary_spec.rb index 5f1bd526..0adef527 100644 --- a/spec/cucumber/core/report/summary_spec.rb +++ b/spec/cucumber/core/report/summary_spec.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'cucumber/core/event_bus' -require 'cucumber/core/events' require 'cucumber/core/report/summary' require 'cucumber/core/test/result' require 'cucumber/core/test/step' diff --git a/spec/cucumber/core/test/case_spec.rb b/spec/cucumber/core/test/case_spec.rb index beb6a026..38c1fa61 100644 --- a/spec/cucumber/core/test/case_spec.rb +++ b/spec/cucumber/core/test/case_spec.rb @@ -1,9 +1,7 @@ # frozen_string_literal: true -require 'cucumber/core' require 'cucumber/core/gherkin/writer' require 'cucumber/core/platform' -require 'cucumber/core/test/case' describe Cucumber::Core::Test::Case do include Cucumber::Core diff --git a/spec/cucumber/core/test/location_spec.rb b/spec/cucumber/core/test/location_spec.rb index 8530cbcc..e3d01d5c 100644 --- a/spec/cucumber/core/test/location_spec.rb +++ b/spec/cucumber/core/test/location_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'cucumber/core/test/location' - module Cucumber module Core module Test diff --git a/spec/cucumber/core/test/runner_spec.rb b/spec/cucumber/core/test/runner_spec.rb index 65ed7669..d156ced8 100644 --- a/spec/cucumber/core/test/runner_spec.rb +++ b/spec/cucumber/core/test/runner_spec.rb @@ -2,9 +2,9 @@ require 'cucumber/core/test/around_hook' require 'cucumber/core/test/hook_step' -require 'cucumber/core/test/runner' require 'cucumber/core/test/case' require 'cucumber/core/test/step' + require 'support/duration_matcher' describe Cucumber::Core::Test::Runner do diff --git a/spec/cucumber/core_spec.rb b/spec/cucumber/core_spec.rb index 4ff754ee..13b37c65 100644 --- a/spec/cucumber/core_spec.rb +++ b/spec/cucumber/core_spec.rb @@ -3,7 +3,6 @@ require 'support/report_api_spy' require 'support/activate_steps_for_self_test' -require 'cucumber/core' require 'cucumber/core/filter' require 'cucumber/core/gherkin/writer' require 'cucumber/core/platform'