Skip to content

Commit

Permalink
upgrade cucumber
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Dunn committed Aug 28, 2024
1 parent 4ba7b77 commit ca6b8f7
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gemspec name: 'flatware-cucumber'

group :development do
gem 'appraisal'
gem 'aruba', '~> 0.14'
gem 'aruba'
gem 'pry'
gem 'racc'
gem 'rake'
Expand Down
1 change: 1 addition & 0 deletions cucumber.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default: --publish-quiet
4 changes: 2 additions & 2 deletions features/step_definitions/flatware_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def duration(&_block)
command = ['flatware', args, '-w', max_workers].flatten.compact.join(' ')

@duration = duration do
run_command_and_stop(command, fail_on_exit: false)
run_command(command)
end
end

Expand Down Expand Up @@ -115,7 +115,7 @@ def duration(&_block)

Then 'the output contains a backtrace' do
trace = <<-TXT.gsub(/^ +/, '')
features/flunk.feature:4:in `Given flunk'
features/flunk.feature:4:in `flunk'
TXT

expect(flatware_process).to have_output Regexp.new Regexp.escape trace
Expand Down
22 changes: 2 additions & 20 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,10 @@

World(Module.new do
def max_workers
return 3 if travis?

Etc.nprocessors
end

def travis?
ENV.key? 'TRAVIS'
end
end)

Before do
if travis?
%i[
command
directory
environment
stderr
stdout
].each(&aruba.announcer.method(:activate))
end
end

After do |_scenario|
all_commands.reject(&:stopped?).each do |command|
zombie_pids = Flatware.pids_of_group(command.pid)
Expand All @@ -55,9 +37,9 @@ def travis?
end

After 'not @non-zero' do |scenario|
expect(flatware_process.exit_status).to eq 0 if flatware_process && (scenario.status == :passed)
expect(last_command_stopped.exit_status).to eq 0 if flatware_process && (scenario.status == :passed)
end

After '@non-zero' do |scenario|
expect(flatware_process.exit_status).to eq 1 if flatware_process && (scenario.status == :passed)
expect(last_command_stopped.exit_status).to eq 1 if flatware_process && (scenario.status == :passed)
end
2 changes: 1 addition & 1 deletion flatware-cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.licenses = ['MIT']
s.required_ruby_version = ['>= 2.6', '< 3.4']
s.require_paths = ['lib']
s.add_dependency %(cucumber), '~> 3.0'
s.add_dependency %(cucumber), '~> 9.1'
s.add_dependency %(flatware), Flatware::VERSION
# s.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion lib/flatware/cucumber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def feature_files
def configure(args, out_stream = $stdout, error_stream = $stderr)
raw_args = args.dup
cli_config = ::Cucumber::Cli::Configuration.new(out_stream, error_stream)
cli_config.parse! args + %w[--format Flatware::Cucumber::Formatter]
cli_config.parse! args + %w[--format Flatware::Cucumber::Formatter --publish-quiet]
cucumber_config = ::Cucumber::Configuration.new cli_config
Config.new cucumber_config, raw_args
end
Expand Down
18 changes: 15 additions & 3 deletions spec/flatware/cucumber_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,27 @@
FEATURE

Dir.chdir Pathname(Dir.pwd).join('tmp/aruba') do
described_class.run('features/feature_1.feature', [])
described_class.run('features/feature_2.feature', [])
described_class.run([1, 2].map { |n| "features/feature_#{n}.feature" }, [])

expect(Flatware).to have_received(:ran).with(1)
expect(Flatware).to have_received(:ran).with(2)
expect(Flatware).to have_received(:ran).with(3)
expect(Flatware).to have_received(:ran).exactly(3).times
expect(sink).to have_received(:progress).exactly(3).times
expect(sink).to have_received(:checkpoint).exactly(2).times

expect(sink).to have_received(:checkpoint).with(
have_attributes(
scenarios: match_array(
%w[
features/feature_1.feature:2
features/feature_1.feature:4
features/feature_2.feature:2
].map do |file_colon_line|
have_attributes(file_colon_line: file_colon_line)
end
)
)
)
end
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
RSpec.configure do |config|
config.include WaitingSupport
config.raise_errors_for_deprecations!
config.example_status_persistence_file_path = 'tmp/examples.txt'
config.around :each, :verbose do |example|
Flatware.verbose = true
example.run
Expand Down

0 comments on commit ca6b8f7

Please sign in to comment.