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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmYzZjA0YjJlYmUxYzg0MTJiYTE2YTAyNmI3ZGUzYjcxYzIyYjQ3Yg==
4
+ Y2RlY2JmMTcyYTNjMDg2ZWU5NjQxNDcwM2E1YjRlMDFjMGU4Mzg4Yw==
5
5
  data.tar.gz: !binary |-
6
- NWU3NTc0ZmI4OWE0NDQ0NjE2MDkyOWVkNWExYTIyMDVjYWQ1M2M0NQ==
6
+ MWJjMWZhMDYwOTA1ZWQwZGE0YTYxN2Q5YmM1YTc5ZjliZmY1NGQxOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Y2ZjNDdiMjZkYTlmMGI0MzRjOTk1ZDQxYzJmMTM2MDRjOTMwNWExZWM2MTYz
10
- NWU1ZjA0MmE0OTk5ZDMxNWIwMmJmZmE1OGE0NTM3NGViNjI2ZjRjMDE5NjRm
11
- OWQ4MjE5YmE0ZmU1NjNlNzJmMmYwN2UwZDgxNGQ0YzhjMzJmNTI=
9
+ YTllNzIwY2RiMmU2NTM5N2E2OTEzZTNiOWU2NWUzYjQ3ZmRjMzVmNDU2N2M2
10
+ NGRmMTk2MDM3MmU2MDkxM2M4ZDFlYzU3YmNmMTU5MjY0NGExODVjZmMzOGQy
11
+ Zjg3MWU1ZWM1NTFhZTA5MzBjNTM1M2M3YmYyY2JiZWY5YjdlMTk=
12
12
  data.tar.gz: !binary |-
13
- NTA4NDI4MjNkNGJlZDQ3OTMzNThiNjZhYzJjYTQ3ZWQ3Yjg1ZDU3NWJjZDNl
14
- NjkxN2E3ZDMzY2ExMjg4OGRlNDc4YjFmODk2YWIzZTAzNDUwZjQ5ZmFkOWUw
15
- M2IwNzRkZDg3NzI3MWI5ODdkMTZlZjY1ZTg4NGMwZDQ0YTIwMzY=
13
+ NDE5YTIyYmRkZDZlYjQ0NzZkNzFjYTAzZGQ4ZGY5N2I1ZjQ1OGY5MDUwZThh
14
+ YmNiNWZiNTM0ZGE4NTVmMWZkOGI4MTE1ZmVkNGI4OTRmODU1NTQ4NTZhYThm
15
+ NjMyMGE3MWNiYzUyOTJhNTFmM2FiY2RkZWYzOWQzMjZkOGY2ZTc=
@@ -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
@@ -1,3 +1,3 @@
1
1
  class Exercism
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -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(project_dir, 'ruby', 'queens', 'test.rb')
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exercism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen