Sha256: 56ae153ec5610cf3e2af0c9d60e08b8af8bde4937405c5c3e49131a41d2c7037

Contents?: true

Size: 1.1 KB

Versions: 205

Compression:

Stored size: 1.1 KB

Contents

require_relative '../../test_helper.rb'

module Generator
  module Files
    class GeneratorCasesTest < Minitest::Test
      def test_available
        track_path = '/track'
        fake_filenames = %w(/track/zzz/alpha_case.rb /track/aaa/hy_phen_ated_case.rb)
        Dir.stub :glob, fake_filenames do
          assert_equal %w(alpha hy-phen-ated), GeneratorCases.available(track_path)
        end
      end

      def test_available_calls_glob_with_the_right_arguments
        track_path = '/track'
        expected_glob = "#{track_path}/exercises/*/.meta/generator/*_case.rb"
        mock_glob_call = Minitest::Mock.new
        mock_glob_call.expect :call, [], [expected_glob, File::FNM_DOTMATCH]
        Dir.stub :glob, mock_glob_call do
          GeneratorCases.available(track_path)
        end
        mock_glob_call.verify
      end

      def test_source_filepath
        track_path = '/track'
        slug = 'slug'
        expected_filename = track_path + '/exercises/slug/.meta/generator/slug_case.rb'
        assert_equal expected_filename, GeneratorCases.source_filepath(track_path, slug)
      end
    end
  end
end

Version data entries

205 entries across 205 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.179 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.178 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.177 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.176 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.175 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.174 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.173 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.172 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.171 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.170 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.169 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.167 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.166 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.165 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.164 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.163 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.162 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.161 tracks/ruby/test/generator/files/generate_cases_test.rb
trackler-2.2.1.160 tracks/ruby/test/generator/files/generate_cases_test.rb