testmetrics_rspec 0.2.0 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f442413399ca375da33c09ac075f6089c76eb539e431bb7a71a99e58fb0deef3
4
- data.tar.gz: 4ab090299facb131c0e13a0a65bc1290afc28c699799fbf9442167fcdf400dba
3
+ metadata.gz: a03b098d96ca6099897c735c5b4b9eec71089ff6f7d6f261a7aff728b838557d
4
+ data.tar.gz: 1aa00b791ed33c8106228da7ffc72937a25d3c88825dc3289eb8f75c7accf50c
5
5
  SHA512:
6
- metadata.gz: 85851e3687a1ea8098d71ddf1e530bc3fdee1ffae0a81dee1a6ce4c8d894d3d0f80cc1a3bca1ef63f14c225cfba4fe3568c37be8a0b6caf6fd8297f965f5556d
7
- data.tar.gz: ae1a9e350328fd93165a21235fb6d0fee309bc5153275414a2233d0f8678c585622b97f35d6892c33c29b10e225977f48a56c4758467b710697d11cb3c757a22
6
+ metadata.gz: 352b85462001c1826f476950dfc5be7ccee14b61d83856f766ef660c1e276853d87ab94115702609c013a7072c2cb68719f7d6c05f6e89be486d395745058e27
7
+ data.tar.gz: 148e2c62497a7d03cfb61a8df67b6a05fc92f6e66d2be31fda0ef843e44463e5f1dc88a8c6e5b38fe7a3deeda67515be04968e290598ca6457576e5be040fcef
data/README.md CHANGED
@@ -1,2 +1,56 @@
1
- # testmetrics_rspec
2
- The official RSpec client for Testmetrics
1
+ # Testmetrics RSpec [![Build Status](https://travis-ci.org/Testmetrics/testmetrics_rspec.svg?branch=master)](https://travis-ci.org/Testmetrics/testmetrics_rspec) [![Gem version](http://img.shields.io/gem/v/testmetrics_rspec.svg)](https://rubygems.org/gems/testmetrics_rspec)
2
+
3
+ The official [RSpec][rspec] 2 & 3 client for [Testmetrics](https://www.testmetrics.app). This client collects data about your RSpec test suites after being run in CI and sends that data to Testmetrics so you can gain valuable insights about your test suite.
4
+
5
+ ## Usage
6
+
7
+ Install the gem:
8
+
9
+ ```sh
10
+ gem install testmetrics_rspec
11
+ ```
12
+
13
+ Use it:
14
+
15
+ ```sh
16
+ rspec --format TestmetricsRspec
17
+ ```
18
+
19
+ You can use it in combination with other [formatters][rspec-formatters], too:
20
+
21
+ ```sh
22
+ rspec --format progress --format TestmetricsRspec
23
+ ```
24
+
25
+ [rspec-formatters]: https://relishapp.com/rspec/rspec-core/v/3-6/docs/formatters
26
+
27
+ In order for the metrics to be send to Testmetrics, you must have your
28
+ Testmetrics Project Key set in the "TESTMETRICS_PROJECT_KEY" environment
29
+ variable in your CI environment. If this environment variable isn't set, the
30
+ collected metrics for your CI run will be discarded. This key should be kept
31
+ private and not exposed to the public.
32
+
33
+ ### Using in your project with Bundler
34
+
35
+ Add it to your Gemfile if you're using [Bundler][bundler]. Put it in the same groups as rspec.
36
+
37
+ ```ruby
38
+ group :test do
39
+ gem "rspec"
40
+ gem "testmetrics_rspec"
41
+ end
42
+ ```
43
+
44
+ Put the same arguments as the commands above in [your `.rspec`][rspec-file]:
45
+
46
+ ```sh
47
+ --format TestmetricsRspec
48
+ ```
49
+
50
+ [bundler]: https://bundler.io
51
+ [rspec-file]: https://relishapp.com/rspec/rspec-core/v/3-6/docs/configuration/read-command-line-configuration-options-from-files
52
+
53
+ ## License
54
+
55
+ `TestmetricsRspec` is offered under the MIT license. For the full license
56
+ text see [LICENSE](https://github.com/testmetrics/testmetrics_rspec/blob/master/LICENSE).
@@ -3,7 +3,11 @@ class TestmetricsRspec
3
3
  module Persist
4
4
  def self.call(results)
5
5
  unless results[:key] == "Unknown"
6
- Faraday.post('https://www.testmetrics.app/results', results)
6
+ Faraday.post do |req|
7
+ req.url 'https://www.testmetrics.app/results'
8
+ req.headers['Content-Type'] = 'application/json'
9
+ req.body = results.to_json
10
+ end
7
11
  end
8
12
  puts results
9
13
  end
@@ -40,7 +40,7 @@ class TestmetricsRspec < RSpec::Core::Formatters::BaseFormatter
40
40
  def tests
41
41
  examples.map do |example|
42
42
  {
43
- name: example.full_description,
43
+ name: example.full_description.delete("\0").delete("\x01").delete("\e"),
44
44
  # Send results in microseconds
45
45
  total_run_time: (example.execution_result[:run_time] * 1_000_000).round(0),
46
46
  state: example.execution_result[:status].to_sym
@@ -20,7 +20,7 @@ class TestmetricsRspec < RSpec::Core::Formatters::BaseFormatter
20
20
  def stop(notification)
21
21
  tests = notification.notifications.map do |test|
22
22
  {
23
- name: test.example.full_description,
23
+ name: test.example.full_description.delete("\0").delete("\x01").delete("\e"),
24
24
  # Send results in microseconds
25
25
  total_run_time: (test.example.execution_result.run_time * 1_000_000).round(0),
26
26
  state: test.example.execution_result.status
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  require 'faraday'
2
3
  require 'rspec/core'
3
4
  require 'rspec/core/formatters/base_formatter'
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "testmetrics_rspec"
7
- spec.version = "0.2.0"
7
+ spec.version = "1.0.0"
8
8
  spec.authors = ["Devon Estes"]
9
9
  spec.email = ["devon.c.estes@gmail.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testmetrics_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devon Estes
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-02 00:00:00.000000000 Z
11
+ date: 2019-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler