Sha256: a765fae9d0c034a4f354e9d7f029f48fcef294850f7a4e0fe70a2b937f3d7679

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

require 'tork/config'

Tork::Config.all_test_file_globs << 'features/**/*.feature'

Tork::Config.test_file_globbers.update(
  # source files that correspond to test files
  %r<^(features/(.+/)?)step_definitions/.+\.rb$> => lambda do |path, matches|
    matches[1] + '*.feature'
  end,

  # the actual test files themselves
  %r<^features/.+\.feature$> => lambda {|path, matches| path }
)

Tork::Config.after_fork_hooks.push lambda {
  |test_file, line_numbers, log_file, worker_number|

  if File.extname(test_file) == '.feature'
    # pass test_file in ARGV to cucumber(1) for running
    ARGV << [test_file, *line_numbers].join(':')
    require 'cucumber'
    require 'rubygems'
    cucumber_bin = Gem.bin_path('cucumber', 'cucumber')
    at_exit { load cucumber_bin unless $! }

    # noopify loading of test_file in Tork::Master#test()
    # because cucumber feature files are not Ruby scripts
    require 'tempfile'
    test_file.replace Tempfile.new('tork-cucumber').path
  end
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tork-17.1.0 lib/tork/config/cucumber.rb
tork-17.0.1 lib/tork/config/cucumber.rb