exercism 0.0.7 → 0.0.8
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/config.rb +1 -0
- data/lib/exercism/version.rb +1 -1
- data/test/exercism/config_test.rb +27 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjYyYTE2NGU4YzE3MWNmYTY2YTY0ZTY5YjU4ZDgwOTlkZDY1OTY5OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTk2NTY5NWY5ZDcyYWNhMzEyNTQzNjE2ZWYyNTVjOGRhYjU2NTkwNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmMzYzgxMjVlNjI2OWY4NzI2ZWJhODY5MWFmNWNmNmY1NjNmNGJhOGNlNDEw
|
10
|
+
MzA4YWFjODY0YjU2MGRjYjg4NzdlYzc4YjQ4N2UzY2JmYzZmYjZlY2FkZGI0
|
11
|
+
ZWYyY2MyM2MxYWM2M2U5YWUzZjE2OGJkMWU0Y2U3ODIwNDBlNWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmVlNzIxMWJmZGE4ZjBkYzYxZmQzMzNjYWU4ZDhhNjJkOWUxODcxN2NiZmE3
|
14
|
+
MDZhNTIwNzQzYjk3MjBhMjk1ZGRmZGRlNDI0MzE0Mjk3ZWZlMzQ3YzcxZjc4
|
15
|
+
NTA0YmQ1YjgzN2JiM2QzNDQ4ZDc3ZWI1OTgzMjRiOTM4YzVjZmM=
|
data/lib/exercism/config.rb
CHANGED
data/lib/exercism/version.rb
CHANGED
@@ -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
|
-
|
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
|
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' => '/
|
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 '/
|
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
|