stream-ci-ruby-rspec 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stream_ci/ruby/rspec/runner.rb +33 -8
- data/lib/stream_ci/ruby/rspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 450d2c88873877f2e5a02e03367743f8bda3448fa0381791852fff4dcb045687
|
4
|
+
data.tar.gz: 1ac3d635f89cd40bbb115627441642fc784192b4fbc8dc47fc6bf0d1d139bced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aa60bff72581de0d1322993dd170a56fcb67ea1e48095269636f9d0e93aff18f0f763ee97a4d098e4502a0e8d2a56f705ceb4a0751c6d9eb318c624cd6922c7
|
7
|
+
data.tar.gz: 68ed072757a09f34baa6a4467b32e37a0ce929a81f364f0a944ec2b7fba6b8c5a920615615cc4a2c28da762fe5cb2a70ae1cac3b0d3c366cb61457fea1f7994c
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'rspec/core'
|
2
2
|
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
require 'pry'
|
3
5
|
|
4
6
|
module StreamCi
|
5
7
|
module Ruby
|
@@ -10,13 +12,31 @@ module StreamCi
|
|
10
12
|
@configuration.output_stream = out if @configuration.output_stream == $stdout
|
11
13
|
@options.configure(@configuration)
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
@configuration.output_stream.print(
|
16
|
+
"#\n# Preparing test manifest to send to StreamCI\n#\n"
|
17
|
+
)
|
18
|
+
t1 = Time.now
|
19
|
+
|
20
|
+
project_root = Rails.root.to_s # this needs to be setup via a config option, as non-rails apps might use this
|
21
|
+
spec_root = '/spec' # pull from rspec config?
|
22
|
+
test_manifest = Dir["#{project_root}#{spec_root}/**/*_spec.rb"].map do |fp|
|
23
|
+
fp.gsub("#{project_root}/", '')
|
16
24
|
end
|
17
25
|
|
18
|
-
opts = {
|
19
|
-
|
26
|
+
opts = {
|
27
|
+
query: {
|
28
|
+
api_key: '12345',
|
29
|
+
branch: 'test',
|
30
|
+
build: '1',
|
31
|
+
test_manifest: test_manifest & @options.args
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
stream_ci_url = ENV['STREAM_CI_URL'] || 'https://api.streamci.com'
|
36
|
+
HTTParty.post("#{stream_ci_url}/v1/tests", opts)
|
37
|
+
|
38
|
+
t2 = Time.now
|
39
|
+
@configuration.output_stream.print "#\n# Test manifest sent to StreamCI - (#{((t2 - t1) * 1000).round} ms)\n#\n"
|
20
40
|
|
21
41
|
# TODO
|
22
42
|
# * What do these commands do / mean?
|
@@ -36,15 +56,20 @@ module StreamCi
|
|
36
56
|
@no_failures = true
|
37
57
|
|
38
58
|
opts = { query: { api_key: '12345', branch: 'test', build: '1' } }
|
39
|
-
|
59
|
+
stream_ci_url = ENV['STREAM_CI_URL'] || 'https://api.streamci.com'
|
60
|
+
response = HTTParty.get("#{stream_ci_url}/v1/tests/next", opts)
|
40
61
|
|
62
|
+
binding.pry
|
41
63
|
until response.code == 204 || response.code >= 300 do
|
42
64
|
# should we clear the world / example groups before each one?
|
43
65
|
# will that mess up reporting?
|
44
66
|
#
|
45
67
|
# does this need to be the full path or just spec/some/spec/path ?
|
68
|
+
binding.pry
|
46
69
|
if response.code == 200
|
47
|
-
|
70
|
+
puts "Running #{response.body}"
|
71
|
+
binding.pry
|
72
|
+
load JSON.parse(response.body)['test']
|
48
73
|
unless @world.example_groups.last.run(reporter)
|
49
74
|
@no_failures = false
|
50
75
|
end
|
@@ -60,4 +85,4 @@ module StreamCi
|
|
60
85
|
end
|
61
86
|
end
|
62
87
|
end
|
63
|
-
end
|
88
|
+
end
|