tracks/ruby/test/generator/files/track_files_test.rb in trackler-2.1.0.7 vs tracks/ruby/test/generator/files/track_files_test.rb in trackler-2.1.0.8
- old
+ new
@@ -11,24 +11,32 @@
class TestTrackFiles
def initialize
@paths = FixturePaths
@exercise_name = 'alpha'
end
- attr_reader :paths, :exercise_name
+ attr_accessor :paths, :exercise_name
include TrackFiles
end
def test_tests_version
subject = TestTrackFiles.new
assert_instance_of TestsVersionFile, subject.tests_version
end
def test_example_solution
subject = TestTrackFiles.new
- assert_instance_of ExampleSolutionFile, subject.example_solution
+ expected_filename = FixturePaths.track + '/exercises/alpha/.meta/solutions/alpha.rb'
+ assert_equal expected_filename, subject.example_solution.filename
end
+ def test_legacy_example_solution
+ subject = TestTrackFiles.new
+ subject.exercise_name = 'beta'
+ expected_filename = FixturePaths.track + '/exercises/beta/example.rb'
+ assert_equal expected_filename, subject.example_solution.filename
+ end
+
def test_minitest_tests
subject = TestTrackFiles.new
assert_instance_of MinitestTestsFile, subject.minitest_tests
end
@@ -36,10 +44,11 @@
subject = TestTrackFiles.new
expected_filename = FixturePaths.track + '/exercises/alpha/.meta/generator/test_template.erb'
assert_equal expected_filename, subject.tests_template.filename
end
+
class TestTrackFilesUseDefault
def initialize
@paths = FixturePaths
@exercise_name = 'notemplate'
end
@@ -50,25 +59,10 @@
def test_default_tests_template
subject = TestTrackFilesUseDefault.new
expected_filename = FixturePaths.track + '/lib/generator/test_template.erb'
assert_equal expected_filename, subject.tests_template.filename
end
-
- class TestTrackFilesUseLegacy
- def initialize
- @paths = FixturePaths
- @exercise_name = 'beta'
- end
- attr_reader :paths, :exercise_name
- include TrackFiles
- end
-
- def test_legacy_tests_template
- subject = TestTrackFilesUseLegacy.new
- expected_filename = FixturePaths.track + '/exercises/beta/example.tt'
- assert_equal expected_filename, subject.tests_template.filename
- end
end
class TestsVersionFileTest < Minitest::Test
class TestTestsVersionFile < TestsVersionFile
def save(content)
@@ -88,10 +82,12 @@
content
end
end
def test_update_version
- subject = TestExampleSolutionFile.new(filename: 'test/fixtures/xruby/exercises/alpha/example.rb')
+ subject = TestExampleSolutionFile.new(
+ filename: 'test/fixtures/xruby/exercises/alpha/.meta/solutions/alpha.rb'
+ )
assert_match(/VERSION = 2/, subject.update_version(2))
end
end
class MinitestTestsFileTest < Minitest::Test