Sha256: 2e522667242b2e11c623288455d25e639afa93680b86927dc12a99c1802d8d84

Contents?: true

Size: 974 Bytes

Versions: 7

Compression:

Stored size: 974 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 |matches|
    matches[1] + '*.feature'
  end,

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

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

  if test_file.end_with? '.feature'
    original_argv = ARGV.dup
    begin
      # pass the feature file to cucumber(1) in ARGV
      ARGV.push [test_file, *line_numbers].join(':')
      require 'rubygems'
      require 'cucumber'
      load Gem.bin_path('cucumber', 'cucumber')
    ensure
      # Restore ARGV for other at_exit hooks.  Otherwise, RSpec's hook will
      # try to load the non-Ruby feature file from ARGV and fail accordingly.
      ARGV.replace original_argv
    end
  end
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tork-18.2.4 lib/tork/config/cucumber.rb
tork-18.2.3 lib/tork/config/cucumber.rb
tork-18.2.2 lib/tork/config/cucumber.rb
tork-18.2.1 lib/tork/config/cucumber.rb
tork-18.2.0 lib/tork/config/cucumber.rb
tork-18.1.0 lib/tork/config/cucumber.rb
tork-18.0.1 lib/tork/config/cucumber.rb