Sha256: 95f70dcbf08b5912c8e6612a159ac5fa6722dad446278a7e1b2adf90ece4bb77

Contents?: true

Size: 1.17 KB

Versions: 98

Compression:

Stored size: 1.17 KB

Contents

require_relative '../test_helper'
require 'tmpdir'

class ExerciseTest < Minitest::Test
  def test_all
    Dir.mktmpdir('exercise-test') do |dir|
      FileUtils.mkdir "#{dir}/test"
      FileUtils.mkdir "#{dir}/test2"
      FileUtils.touch "#{dir}/TRACK_HINTS.md"

      FileList.stub :[], FileList["#{dir}/*"] do
        assert_equal true, Exercise.all.all? { |e| e.instance_of?(Exercise) }
        assert_equal ['test', 'test2'], Exercise.all.map(&:name)
      end
    end
  end

  def test_name
    exercise = Exercise.new('name')
    assert_equal 'name', exercise.name
  end

  def test_to_s
    exercise = Exercise.new('name')
    assert_equal 'name', exercise.to_s
  end

  def test_directory
    exercise = Exercise.new('exercise_name')
    assert_equal 'exercises/exercise_name/.', exercise.directory
  end

  def test_example_file
    assert_equal 'example.rb', Exercise.new('').example_file
  end

  def test_testable_example_file
    exercise = Exercise.new('all-your-base')
    assert_equal 'all_your_base.rb', exercise.testable_example_file
  end

  def test_test_file
    exercise = Exercise.new('all-your-base')
    assert_equal 'all_your_base_test.rb', exercise.test_file
  end
end

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
trackler-2.1.0.7 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.1.0.6 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.1.0.5 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.1.0.4 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.1.0.3 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.1.0.2 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.1.0.1 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.1.0.0 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.55 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.54 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.53 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.52 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.51 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.50 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.49 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.48 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.47 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.46 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.45 tracks/ruby/test/tasks/exercise_test.rb
trackler-2.0.8.44 tracks/ruby/test/tasks/exercise_test.rb