test/exercism/assignment_test.rb in exercism-0.0.9 vs test/exercism/assignment_test.rb in exercism-0.0.10
- old
+ new
@@ -12,12 +12,16 @@
def readme_path
File.join(project_dir, 'ruby', 'queens', 'README.md')
end
+ def tests_dir
+ File.join(project_dir, 'ruby', 'queens')
+ end
+
def tests_path
- File.join(project_dir, 'ruby', 'queens', 'test.rb')
+ File.join(tests_dir, 'test.rb')
end
def assignment_data
{
'track' => 'ruby',
@@ -33,8 +37,20 @@
assignment = Exercism::Assignment.new(assignment_data)
assignment.save
assert_equal "Do it", File.read(readme_path)
assert_equal "assert true", File.read(tests_path)
+ end
+
+ def test_do_not_overwrite_existing_test_file
+ FileUtils.mkdir_p(tests_dir)
+ FileUtils.touch(tests_path)
+ File.open(tests_path, 'w') do |file|
+ file.write 'assert false'
+ end
+
+ Exercism::Assignment.new(assignment_data).save
+
+ assert_equal "assert false", File.read(tests_path)
end
end