exercism 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGE1N2I3MGM2YjNmZDRhMGZlOTBiMjljOWExMzE5NjNlYmVlYzRjYw==
4
+ YjYyYTE2NGU4YzE3MWNmYTY2YTY0ZTY5YjU4ZDgwOTlkZDY1OTY5OQ==
5
5
  data.tar.gz: !binary |-
6
- OGI3ODhjMmE3ZDJkODAyMGNkOTI5NmU5MWM1YzU0ZGM5MTBhMTg3NA==
6
+ OTk2NTY5NWY5ZDcyYWNhMzEyNTQzNjE2ZWYyNTVjOGRhYjU2NTkwNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmM4NDA5MzUwN2VkNjE2ZTE2ZDcxNzg2NGYyMzM0MGFlM2E2MWEwOWIxZWFl
10
- YzBkZDhjNDU5MGUwOTJhYjAxMGNmNzNlOTY0MTE2MzU2YmMzYTczNzQ5MGNi
11
- ZDhjODQ4MTgzNWY4MjYyNjg3ZmQ3ZjRmNjE2NjJiMzUyNzA0NDQ=
9
+ NmMzYzgxMjVlNjI2OWY4NzI2ZWJhODY5MWFmNWNmNmY1NjNmNGJhOGNlNDEw
10
+ MzA4YWFjODY0YjU2MGRjYjg4NzdlYzc4YjQ4N2UzY2JmYzZmYjZlY2FkZGI0
11
+ ZWYyY2MyM2MxYWM2M2U5YWUzZjE2OGJkMWU0Y2U3ODIwNDBlNWM=
12
12
  data.tar.gz: !binary |-
13
- OGJjMTdkMDNiZWY5YWE1OWU0MjFjNzljOWE4ZDU2YmM4MzAzNDM0NmE0Zjkx
14
- NGFkZDIxN2I0ZTA0NjJmYzFlMmNhMDFkNGM5ODI1YTE1MDRkZjYxNmRjMGJj
15
- YTEyMTQ4OTQ2M2Q1OGM4MTQyM2FkYmI0ZTA3YjFiNjRjNTQzNGM=
13
+ MmVlNzIxMWJmZGE4ZjBkYzYxZmQzMzNjYWU4ZDhhNjJkOWUxODcxN2NiZmE3
14
+ MDZhNTIwNzQzYjk3MjBhMjk1ZGRmZGRlNDI0MzE0Mjk3ZWZlMzQ3YzcxZjc4
15
+ NTA0YmQ1YjgzN2JiM2QzNDQ4ZDc3ZWI1OTgzMjRiOTM4YzVjZmM=
@@ -33,6 +33,7 @@ class Exercism
33
33
  end
34
34
 
35
35
  def save
36
+ FileUtils.mkdir_p(project_dir)
36
37
  File.open file, 'w' do |f|
37
38
  data = {
38
39
  'github_username' => github_username,
@@ -1,3 +1,3 @@
1
1
  class Exercism
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -2,38 +2,44 @@ require './test/test_helper'
2
2
 
3
3
  class ConfigTest < MiniTest::Unit::TestCase
4
4
 
5
+ def path
6
+ './test/fixtures'
7
+ end
8
+
9
+ def key
10
+ '7a7096c'
11
+ end
12
+
5
13
  def teardown
6
14
  if File.exists?('./test/fixtures/.exercism')
7
15
  FileUtils.rm('./test/fixtures/.exercism')
8
16
  end
17
+
18
+ if File.exists?('./test/fixtures/some/project/dir')
19
+ FileUtils.rm_r('./test/fixtures/some')
20
+ end
9
21
  end
10
22
 
11
23
  def test_read_config_file
12
- path = './test/fixtures/home'
13
- key = '634abfb095ed621e1c793c9875fcd9fda455ea90'
14
- config = Exercism::Config.read(path)
24
+ config = Exercism::Config.read('./test/fixtures/home')
15
25
  assert_equal 'alice', config.github_username
16
- assert_equal key, config.key
26
+ assert_equal '634abfb095ed621e1c793c9875fcd9fda455ea90', config.key
17
27
  assert_equal '/tmp', config.project_dir
18
28
  end
19
29
 
20
30
  def test_write_config_file
21
- path = './test/fixtures'
22
- key = '7a7096c'
23
31
  data = {
24
32
  'github_username' => 'bob',
25
33
  'key' => key,
26
- 'project_dir' => '/dev/null'
34
+ 'project_dir' => '/tmp'
27
35
  }
28
36
  config = Exercism::Config.write(path, data)
29
37
  assert_equal 'bob', config.github_username
30
38
  assert_equal key, config.key
31
- assert_equal '/dev/null', config.project_dir
39
+ assert_equal '/tmp', config.project_dir
32
40
  end
33
41
 
34
42
  def test_delete_config_file
35
- path = './test/fixtures'
36
- key = '7a7096c'
37
43
  data = {
38
44
  'github_username' => 'bob',
39
45
  'key' => key,
@@ -45,4 +51,15 @@ class ConfigTest < MiniTest::Unit::TestCase
45
51
  assert !File.exists?(filename)
46
52
  end
47
53
 
54
+ def test_write_directory_if_missing
55
+ project_dir = './test/fixtures/some/project/dir'
56
+ data = {
57
+ 'github_username' => 'bob',
58
+ 'key' => key,
59
+ 'project_dir' => project_dir
60
+ }
61
+ Exercism::Config.write(path, data)
62
+ assert File.exist? project_dir
63
+ end
64
+
48
65
  end
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen