exercism 0.0.24 → 0.0.25
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.
- data/lib/cli.rb +1 -1
- data/lib/exercism/submission.rb +8 -1
- data/lib/exercism/version.rb +1 -1
- data/test/exercism/submission_test.rb +32 -0
- data/test/fixtures/ruby/bob/bob.rb +5 -0
- metadata +4 -2
data/lib/cli.rb
CHANGED
|
@@ -68,7 +68,7 @@ class Exercism
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
begin
|
|
71
|
-
response = Exercism::Api.new(options[:host], Exercism.user).submit(submission.
|
|
71
|
+
response = Exercism::Api.new(options[:host], Exercism.user).submit(submission.path)
|
|
72
72
|
|
|
73
73
|
body = JSON.parse(response.body)
|
|
74
74
|
if body["error"]
|
data/lib/exercism/submission.rb
CHANGED
|
@@ -10,6 +10,10 @@ class Exercism
|
|
|
10
10
|
@file = file
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def path
|
|
14
|
+
File.absolute_path(file)
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
def test?
|
|
14
18
|
test_identifiers.any? do |_, suffix|
|
|
15
19
|
file.end_with?(suffix)
|
|
@@ -20,7 +24,10 @@ class Exercism
|
|
|
20
24
|
{
|
|
21
25
|
:ruby => '_test.rb',
|
|
22
26
|
:js => '.spec.js',
|
|
23
|
-
:elixir => '_test.exs'
|
|
27
|
+
:elixir => '_test.exs',
|
|
28
|
+
:clojure => '_test.clj',
|
|
29
|
+
:python => '_test.py',
|
|
30
|
+
:go => '_test.go',
|
|
24
31
|
}
|
|
25
32
|
end
|
|
26
33
|
|
data/lib/exercism/version.rb
CHANGED
|
@@ -25,4 +25,36 @@ class SubmissionTest < Minitest::Test
|
|
|
25
25
|
def test_identifies_javascript_tests
|
|
26
26
|
assert Exercism::Submission.test?('queens.spec.js')
|
|
27
27
|
end
|
|
28
|
+
|
|
29
|
+
def test_knows_clojure_code
|
|
30
|
+
refute Exercism::Submission.test?('queens.clj')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_identifies_clojure_tests
|
|
34
|
+
assert Exercism::Submission.test?('queens_test.clj')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_knows_python_code
|
|
38
|
+
refute Exercism::Submission.test?('queens.py')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_identifies_python_tests
|
|
42
|
+
assert Exercism::Submission.test?('queens_test.py')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_knows_go_code
|
|
46
|
+
refute Exercism::Submission.test?('queens.go')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_identifies_go_tests
|
|
50
|
+
assert Exercism::Submission.test?('queens_test.go')
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_full_path
|
|
54
|
+
submission = Exercism::Submission.new('./test/fixtures/ruby/bob/bob.rb')
|
|
55
|
+
refute submission.path.start_with?('.')
|
|
56
|
+
assert submission.path.end_with?('/test/fixtures/ruby/bob/bob.rb')
|
|
57
|
+
diff = submission.path.length - submission.file.length
|
|
58
|
+
assert diff > 1
|
|
59
|
+
end
|
|
28
60
|
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.
|
|
4
|
+
version: 0.0.25
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-08-
|
|
12
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: json
|
|
@@ -206,6 +206,7 @@ files:
|
|
|
206
206
|
- test/fixtures/approvals/alice_gets_word_count_readme.approved.txt
|
|
207
207
|
- test/fixtures/approvals/alice_gets_word_count_tests.approved.txt
|
|
208
208
|
- test/fixtures/home/.exercism
|
|
209
|
+
- test/fixtures/ruby/bob/bob.rb
|
|
209
210
|
- test/fixtures/vcr_cassettes/alice-gets-bob.yml
|
|
210
211
|
- test/fixtures/vcr_cassettes/alice-gets-word-count.yml
|
|
211
212
|
- test/fixtures/vcr_cassettes/alice-submits-bob.yml
|
|
@@ -247,6 +248,7 @@ test_files:
|
|
|
247
248
|
- test/fixtures/approvals/alice_gets_word_count_readme.approved.txt
|
|
248
249
|
- test/fixtures/approvals/alice_gets_word_count_tests.approved.txt
|
|
249
250
|
- test/fixtures/home/.exercism
|
|
251
|
+
- test/fixtures/ruby/bob/bob.rb
|
|
250
252
|
- test/fixtures/vcr_cassettes/alice-gets-bob.yml
|
|
251
253
|
- test/fixtures/vcr_cassettes/alice-gets-word-count.yml
|
|
252
254
|
- test/fixtures/vcr_cassettes/alice-submits-bob.yml
|