Sha256: dec4e88ddbd03c185958c9f143e390cbe94e9b3b2bb603e4ccdda6f250895e23

Contents?: true

Size: 732 Bytes

Versions: 101

Compression:

Stored size: 732 Bytes

Contents

require 'rake/file_utils_ext'
require 'tmpdir'

class ExerciseTestsRunner
  include Rake::FileUtilsExt

  def initialize(exercise:, test_options: '')
    @exercise = exercise
    @test_options = test_options
  end

  def run
    puts "\n\n#{'-' * 64}\nrunning tests for: #{@exercise}"

    Dir.mktmpdir(@exercise.name) do |dir|
      setup_exercise_files_in(dir)
      run_exercise_tests_in(dir)
    end
  end

  private

  def setup_exercise_files_in(dir)
    FileUtils.cp_r @exercise.directory, dir
    FileUtils.mv "#{dir}/#{@exercise.example_file}", "#{dir}/#{@exercise.testable_example_file}"
  end

  def run_exercise_tests_in(dir)
    ruby "-I lib -r disable_skip.rb #{dir}/#{@exercise.test_file} #{@test_options}"
  end
end

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
trackler-2.1.0.11 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.10 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.9 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.8 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.7 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.6 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.5 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.4 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.3 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.2 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.1 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.1.0.0 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.55 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.54 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.53 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.52 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.51 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.50 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.49 tracks/ruby/lib/tasks/exercise_tests_runner.rb
trackler-2.0.8.48 tracks/ruby/lib/tasks/exercise_tests_runner.rb