Sha256: 679cd451e373248947356ed35fcbc6998850f8d31b88c711118f6dca617abc41

Contents?: true

Size: 1.18 KB

Versions: 98

Compression:

Stored size: 1.18 KB

Contents

require_relative '../test_helper'

class FakeExercise
  def name
    'test'
  end

  alias :to_s :name

  def directory
    'test/.'
  end

  def example_file
    'example.rb'
  end

  def testable_example_file
    'test.rb'
  end

  def test_file
    'test_test.rb'
  end
end

class ExerciseTestsRunnerTest < Minitest::Test
  def test_run
    Dir.stub :mktmpdir, nil, 'dir' do
      cp_mock = Minitest::Mock.new.expect(:call, nil, ['test/.', 'dir'])

      mv_mock = Minitest::Mock.new.expect(
        :call,
        nil,
        ['dir/example.rb', 'dir/test.rb'],
      )

      ruby_mock = Minitest::Mock.new.expect(
        :call,
        nil,
        ['-I lib -r disable_skip.rb dir/test_test.rb -p'],
      )

      FileUtils.stub :cp_r, cp_mock do
        FileUtils.stub :mv, mv_mock do
          runner = ExerciseTestsRunner.new(
            exercise: FakeExercise.new,
            test_options: '-p',
          )

          runner.stub :ruby, ruby_mock do
            assert_output "\n\n#{'-'*64}\nrunning tests for: test\n" do
              runner.run
            end
          end

          cp_mock.verify
          mv_mock.verify
          ruby_mock.verify
        end
      end
    end
  end
end

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
trackler-2.0.8.2 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.8.1 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.7.0 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.44 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.43 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.42 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.41 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.40 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.39 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.38 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.37 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.36 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.35 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.34 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.33 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.32 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.31 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.30 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.29 tracks/ruby/test/tasks/exercise_tests_runner_test.rb
trackler-2.0.6.28 tracks/ruby/test/tasks/exercise_tests_runner_test.rb