Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade cucumber #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 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 'logger'
gem 'ostruct'
gem 'pry'
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 @@ -77,7 +77,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 @@ -113,7 +113,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
37 changes: 14 additions & 23 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 @@ -54,10 +36,19 @@ def travis?
end
end

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

status = begin
last_command_stopped.exit_status
rescue Aruba::NoCommandHasBeenStoppedError
flatware_process.wait.exitstatus
end

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

After('not @non-zero', &expect_flatware_exit.call(0))
After('@non-zero', &expect_flatware_exit.call(1))
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
Loading