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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 408c369adb06a7457719ac8f12f4bf4da8b73a700769adf402352717670d3f94
4
- data.tar.gz: adefcfd935af126e2e2156812ebb12d861ef86538ab1ae4b824797fc69f07a6b
3
+ metadata.gz: 450d2c88873877f2e5a02e03367743f8bda3448fa0381791852fff4dcb045687
4
+ data.tar.gz: 1ac3d635f89cd40bbb115627441642fc784192b4fbc8dc47fc6bf0d1d139bced
5
5
  SHA512:
6
- metadata.gz: f443c555582524df089b53828c4c8d68b66f6899bb4d3043fd91fc02ea1e2f0d32adcf4a00d716fc3de9778bf4dbdb883457e8395cbf498765ca7e30ff2109c8
7
- data.tar.gz: 7b818bb140285d25b6538ba2480e57da74df50120030f48d8b6232535e9b0ab45e43ba2f4d34fa0305b0e6caacc54b2390e8b8222adfaa2937af9388f8d66ee1
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
- root_path = StreamCi::Ruby::Rspec.root
14
- test_manifest = Dir["#{root_path}/**/*_spec.rb"].map do |fp|
15
- fp.gsub("#{root_path}/", '')
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 = { query: { api_key: '12345', branch: 'test', build: '1', test_manifest: test_manifest } }
19
- HTTParty.post('https://api.streamci.com/v1/tests/next', opts)
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
- response = HTTParty.get('https://api.streamci.com/v1/tests/next', opts)
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
- load response.body
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
@@ -1,7 +1,7 @@
1
1
  module StreamCi
2
2
  module Ruby
3
3
  module Rspec
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream-ci-ruby-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Conant