race_condition-rspec 0.0.1.alpha → 0.0.1
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 +4 -4
- data/.travis.yml +8 -0
- data/README.md +21 -3
- data/lib/race_condition/client.rb +14 -1
- data/lib/race_condition/rspec/configuration.rb +14 -1
- data/lib/race_condition/rspec/listener.rb +2 -2
- data/lib/race_condition/rspec/report.rb +5 -3
- data/lib/race_condition/rspec/version.rb +1 -1
- data/race_condition-rspec.gemspec +1 -1
- data/spec/spec_helper.rb +8 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 803501ed2014f25a5ab808cdcf07619d2af2456d
|
4
|
+
data.tar.gz: 109b29242896d4503ee0beb6bd9ec6ae80e00782
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d19035ebe1830ef7c4514fdfe72cf3cecee796d684f05a425657c2011be3bea77c5bc7b3c40727d25ddd6a39f429906a6ee6f7b6b064a372007324f2eac166
|
7
|
+
data.tar.gz: c4d7c4ea43f57bbd1e128c6d9d82127d97d033604746b30b1ada520f338c35381d910657c2ce625d178668d026385babc9786aeee5efdec63e5bf9fdb8d4cb75
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# RaceCondition::Rspec
|
1
|
+
# RaceCondition::Rspec [](https://travis-ci.org/RaceCondition-io/race_condition-rspec)
|
2
2
|
|
3
|
-
|
3
|
+
RSpec client for sending test suite results to RaceCondition.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,25 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Within your `spec_helper.rb`, require `race_condition/rspec` and configure it for your CI.
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require "race_condition/rspec"
|
25
|
+
|
26
|
+
RaceCondition::RSpec.configure do |c|
|
27
|
+
c.report_if = ENV["CI"]
|
28
|
+
c.codebase_id = ENV["CODEBASE_ID"]
|
29
|
+
c.branch_name = ENV["TRAVIS_BRANCH"]
|
30
|
+
c.commit = ENV["TRAVIS_COMMIT"]
|
31
|
+
c.build_number = ENV["TRAVIS_BUILD_NUMBER"]
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
* `report_if` - This is a boolean or lambda that tells the reporter if it should test suite results to the server. Most popular CI servers set the `CI` environment variable.
|
36
|
+
* `codebase_id` - This is the codebase ID from RaceCondition that you want to send the results to.
|
37
|
+
* `branch_name` - The current branch name (optional, but recommended).
|
38
|
+
* `commit` - The commit under test (optional).
|
39
|
+
* `build_number` - The CI's build number (optional).
|
22
40
|
|
23
41
|
## Contributing
|
24
42
|
|
@@ -1,10 +1,13 @@
|
|
1
1
|
module RaceCondition
|
2
2
|
class Client
|
3
3
|
include APISmith::Client
|
4
|
-
|
4
|
+
|
5
|
+
base_uri "http://racecondition.io/"
|
5
6
|
endpoint "api/1"
|
6
7
|
|
7
8
|
def report!(project_id, report_output)
|
9
|
+
return unless report?
|
10
|
+
|
8
11
|
puts "Sending test run data to RaceCondition..."
|
9
12
|
params = { build: report_output }
|
10
13
|
post("projects/#{project_id}/builds", extra_body: params)
|
@@ -14,5 +17,15 @@ module RaceCondition
|
|
14
17
|
|
15
18
|
def check_response_errors(response)
|
16
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def report?
|
24
|
+
config.report?
|
25
|
+
end
|
26
|
+
|
27
|
+
def config
|
28
|
+
RaceCondition::RSpec.configuration
|
29
|
+
end
|
17
30
|
end
|
18
31
|
end
|
@@ -1,7 +1,20 @@
|
|
1
1
|
module RaceCondition
|
2
2
|
module RSpec
|
3
3
|
class Configuration
|
4
|
-
attr_accessor :branch_name,
|
4
|
+
attr_accessor :branch_name,
|
5
|
+
:project_id,
|
6
|
+
:commit,
|
7
|
+
:build_number,
|
8
|
+
:codebase_id,
|
9
|
+
:report_if
|
10
|
+
|
11
|
+
def report?
|
12
|
+
if report_if.respond_to? :call
|
13
|
+
report_if.call
|
14
|
+
else
|
15
|
+
report_if
|
16
|
+
end
|
17
|
+
end
|
5
18
|
end
|
6
19
|
end
|
7
20
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module RaceCondition
|
2
2
|
module RSpec
|
3
3
|
class Listener
|
4
|
-
SUBSCRIPTIONS =
|
5
|
-
|
4
|
+
SUBSCRIPTIONS = [:example_passed, :example_failed, :example_pending,
|
5
|
+
:dump_summary, :seed, :close]
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@report = Report.new
|
@@ -20,7 +20,7 @@ module RaceCondition
|
|
20
20
|
}
|
21
21
|
|
22
22
|
allow_webmock!
|
23
|
-
Client.new.report!(
|
23
|
+
Client.new.report!(config.codebase_id, data)
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
@@ -30,8 +30,6 @@ module RaceCondition
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def metadata
|
33
|
-
config = RaceCondition::RSpec.configuration
|
34
|
-
|
35
33
|
{
|
36
34
|
branch_name: config.branch_name,
|
37
35
|
commit: config.commit,
|
@@ -39,6 +37,10 @@ module RaceCondition
|
|
39
37
|
}
|
40
38
|
end
|
41
39
|
|
40
|
+
def config
|
41
|
+
RaceCondition::RSpec.configuration
|
42
|
+
end
|
43
|
+
|
42
44
|
def examples
|
43
45
|
passed_examples + failed_examples + pending_examples
|
44
46
|
end
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["bolandryanm@gmail.com"]
|
11
11
|
spec.summary = "RSpec client for sending test suite results to RaceCondition."
|
12
12
|
spec.description = "RSpec client for sending test suite results to RaceCondition."
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/RaceCondition-io/race_condition-rspec"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/spec/spec_helper.rb
CHANGED
@@ -3,5 +3,13 @@ Dir['./spec/support/**/*.rb'].map { |f| require f }
|
|
3
3
|
require "pry"
|
4
4
|
require "race_condition/rspec"
|
5
5
|
|
6
|
+
RaceCondition::RSpec.configure do |c|
|
7
|
+
c.report_if = ENV["CI"]
|
8
|
+
c.codebase_id = ENV["CODEBASE_ID"]
|
9
|
+
c.branch_name = ENV["TRAVIS_BRANCH"]
|
10
|
+
c.commit = ENV["TRAVIS_COMMIT"]
|
11
|
+
c.build_number = ENV["TRAVIS_BUILD_NUMBER"]
|
12
|
+
end
|
13
|
+
|
6
14
|
RSpec.configure do |c|
|
7
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: race_condition-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Boland
|
@@ -88,6 +88,7 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
91
92
|
- Gemfile
|
92
93
|
- LICENSE.txt
|
93
94
|
- README.md
|
@@ -103,7 +104,7 @@ files:
|
|
103
104
|
- spec/fakes/spec_helper.rb
|
104
105
|
- spec/integration/race_condition_spec.rb
|
105
106
|
- spec/spec_helper.rb
|
106
|
-
homepage:
|
107
|
+
homepage: https://github.com/RaceCondition-io/race_condition-rspec
|
107
108
|
licenses:
|
108
109
|
- MIT
|
109
110
|
metadata: {}
|
@@ -118,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
119
|
version: '0'
|
119
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
121
|
requirements:
|
121
|
-
- - "
|
122
|
+
- - ">="
|
122
123
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
124
|
+
version: '0'
|
124
125
|
requirements: []
|
125
126
|
rubyforge_project:
|
126
127
|
rubygems_version: 2.2.2
|