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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 842bc5a404dbb509fb615d76281ad0f99ea71dc0
4
- data.tar.gz: 7370977761b2eef65f0c809993679543fbd3a98e
3
+ metadata.gz: 803501ed2014f25a5ab808cdcf07619d2af2456d
4
+ data.tar.gz: 109b29242896d4503ee0beb6bd9ec6ae80e00782
5
5
  SHA512:
6
- metadata.gz: 0d145aec4c674963a21c41d5c7470badaaef39e9781b1265f6d2f84c78461b20c5985686de6fbd0ce2602db917ccb9a93685c9017f17cbf20a63d9d68f0a45d7
7
- data.tar.gz: 0d66a8d4914486435b8be89fd021ff7f0bd15952dae5364690d130c8a5463d386ee8e8e9615a7544ffbbb9efdac59f8877041a9bd1a2945e986ec3aacc6cb9c4
6
+ metadata.gz: d4d19035ebe1830ef7c4514fdfe72cf3cecee796d684f05a425657c2011be3bea77c5bc7b3c40727d25ddd6a39f429906a6ee6f7b6b064a372007324f2eac166
7
+ data.tar.gz: c4d7c4ea43f57bbd1e128c6d9d82127d97d033604746b30b1ada520f338c35381d910657c2ce625d178668d026385babc9786aeee5efdec63e5bf9fdb8d4cb75
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+
3
+ bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
4
+ script: "bundle exec rspec spec"
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # RaceCondition::Rspec
1
+ # RaceCondition::Rspec [![Build Status](https://travis-ci.org/RaceCondition-io/race_condition-rspec.svg?branch=master)](https://travis-ci.org/RaceCondition-io/race_condition-rspec)
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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
- base_uri "http://localhost:3000/"
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, :project_id, :commit, :build_number, :send_to
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 = %i(example_passed example_failed example_pending
5
- dump_summary seed close)
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!("f8e76771aef86908", data)
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
@@ -1,5 +1,5 @@
1
1
  module RaceCondition
2
2
  module Rspec
3
- VERSION = "0.0.1.alpha"
3
+ VERSION = "0.0.1"
4
4
  end
5
5
  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.alpha
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: 1.3.1
124
+ version: '0'
124
125
  requirements: []
125
126
  rubyforge_project:
126
127
  rubygems_version: 2.2.2