exercism 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/exercism/assignment.rb +9 -1
- data/lib/exercism/version.rb +1 -1
- data/test/exercism/assignment_test.rb +17 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2RlY2JmMTcyYTNjMDg2ZWU5NjQxNDcwM2E1YjRlMDFjMGU4Mzg4Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWJjMWZhMDYwOTA1ZWQwZGE0YTYxN2Q5YmM1YTc5ZjliZmY1NGQxOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTllNzIwY2RiMmU2NTM5N2E2OTEzZTNiOWU2NWUzYjQ3ZmRjMzVmNDU2N2M2
|
10
|
+
NGRmMTk2MDM3MmU2MDkxM2M4ZDFlYzU3YmNmMTU5MjY0NGExODVjZmMzOGQy
|
11
|
+
Zjg3MWU1ZWM1NTFhZTA5MzBjNTM1M2M3YmYyY2JiZWY5YjdlMTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDE5YTIyYmRkZDZlYjQ0NzZkNzFjYTAzZGQ4ZGY5N2I1ZjQ1OGY5MDUwZThh
|
14
|
+
YmNiNWZiNTM0ZGE4NTVmMWZkOGI4MTE1ZmVkNGI4OTRmODU1NTQ4NTZhYThm
|
15
|
+
NjMyMGE3MWNiYzUyOTJhNTFmM2FiY2RkZWYzOWQzMjZkOGY2ZTc=
|
data/lib/exercism/assignment.rb
CHANGED
@@ -22,13 +22,21 @@ class Exercism
|
|
22
22
|
|
23
23
|
def save
|
24
24
|
FileUtils.mkdir_p assignment_dir
|
25
|
+
save_readme
|
26
|
+
save_tests unless File.exist?(tests_path)
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
def save_readme
|
25
31
|
File.open readme_path, 'w' do |f|
|
26
32
|
f.write readme
|
27
33
|
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def save_tests
|
28
37
|
File.open tests_path, 'w' do |f|
|
29
38
|
f.write tests
|
30
39
|
end
|
31
|
-
self
|
32
40
|
end
|
33
41
|
|
34
42
|
def assignment_dir
|
data/lib/exercism/version.rb
CHANGED
@@ -14,8 +14,12 @@ class AssignmentTest < MiniTest::Unit::TestCase
|
|
14
14
|
File.join(project_dir, 'ruby', 'queens', 'README.md')
|
15
15
|
end
|
16
16
|
|
17
|
+
def tests_dir
|
18
|
+
File.join(project_dir, 'ruby', 'queens')
|
19
|
+
end
|
20
|
+
|
17
21
|
def tests_path
|
18
|
-
File.join(
|
22
|
+
File.join(tests_dir, 'test.rb')
|
19
23
|
end
|
20
24
|
|
21
25
|
def assignment_data
|
@@ -36,5 +40,17 @@ class AssignmentTest < MiniTest::Unit::TestCase
|
|
36
40
|
assert_equal "Do it", File.read(readme_path)
|
37
41
|
assert_equal "assert true", File.read(tests_path)
|
38
42
|
end
|
43
|
+
|
44
|
+
def test_do_not_overwrite_existing_test_file
|
45
|
+
FileUtils.mkdir_p(tests_dir)
|
46
|
+
FileUtils.touch(tests_path)
|
47
|
+
File.open(tests_path, 'w') do |file|
|
48
|
+
file.write 'assert false'
|
49
|
+
end
|
50
|
+
|
51
|
+
Exercism::Assignment.new(assignment_data).save
|
52
|
+
|
53
|
+
assert_equal "assert false", File.read(tests_path)
|
54
|
+
end
|
39
55
|
end
|
40
56
|
|