Sha256: 74821fbb943f153bec41b3b73e71e907d739806674bca940f3fa8ba0ed976f39

Contents?: true

Size: 799 Bytes

Versions: 14

Compression:

Stored size: 799 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

def main
  begin
    command = create_command
  rescue ArgumentError => e
    abort(e.message)
  end
  puts "Running #{command.join(" ")}"
  system(*command)
end

def create_command
  case ARGV.length
  when 0
    ["bundle", "exec", "rake", "test"]
  when 1
    filename = ARGV[0]
    ["bundle", "exec", "rake", "test", "TEST=#{filename}"]
  when 2
    filename = ARGV[0]
    test_name = ARGV[1]
    test_name_with_underscores = test_name.tr(" ", "_")
    test_name_pattern = "/#{Regexp.escape(test_name_with_underscores)}/"
    ["bundle", "exec", "rake", "test", "TEST=#{filename}", "TESTOPTS=\"--name=#{test_name_pattern} -v\""]
  else
    raise ArgumentError, "Too many arguments. Did you forget to put the test name in quotes?"
  end
end

main

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
job-iteration-1.7.0 bin/test
job-iteration-1.6.0 bin/test
job-iteration-1.5.1 bin/test
job-iteration-1.5.0 bin/test
job-iteration-1.4.1 bin/test
job-iteration-1.4.0 bin/test
job-iteration-1.3.6 bin/test
job-iteration-1.3.5 bin/test
job-iteration-1.3.4 bin/test
job-iteration-1.3.3 bin/test
job-iteration-1.3.2 bin/test
job-iteration-1.3.1 bin/test
job-iteration-1.3.0 bin/test
job-iteration-1.2.0 bin/test