rox-client-rspec 0.3.1 → 0.4.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzNhOWE3OTM3ZGQxNTEzZWE4YmE2ODQ1NWFmZGE4ODE0NDM3MzZiZQ==
4
+ ZGQ4ZTQwZDMyM2M0NjI0M2VjMDU4MmZjYjMzOWZjY2FmZmYyMzhiZg==
5
5
  data.tar.gz: !binary |-
6
- Y2Q5MGU2ZmMzM2NkM2VjMzZiYTNlOTJkYTYwMzFiNzM5YzIyOTFhNA==
6
+ YmIyYjVlOGMyZDg2ZmUwYzk0YzJmOTkzMGFjZWRiY2FhMTRmNTdkOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzRkN2E5OTcyNTE0MTczMTMyYjhkOGY1NDg1ODFjMzA2MzU4OTRkYjQ1NWY2
10
- OGUxNWFhMWI0MzdkZjBmNzk1NmZjMDYzMzhkZDJiOWFlN2Q2MGFmMzgyOWY2
11
- OGY3Mjk4Nzc1NzhhOWI4ZWJkNDMwMzJhN2YxZjU2Y2E1YjU2NzE=
9
+ MWZkOWQxMWMwMzFiNDhiNzE4MGRhNGRlNGQ5N2ZiYjQ4OTE1OTM5MmM5ZDg1
10
+ ZDYyNTg3NzkzZTkxYWZkODU5NjAyMGE3ZDQ0YmM4MDQzZGUzYTgxMzA0ZmM0
11
+ MDlhMmUxY2M0MTRiMGM3ZjNiN2JhZDhlNzc1Y2Y0MmZiYjM2ZWI=
12
12
  data.tar.gz: !binary |-
13
- OGJjNTk5YzQ1YjExZTQ0ZmJhZDMyMjI2YmM2ZjlkOWI0ZTAzNmQwZDQ1NmRk
14
- MTI3NzUzZWY3MzAyNzNkOWNkY2EzYmI1OTExOGZjYzU5ZDE1ZmFjM2ExMmJj
15
- OTcxNmM3ZWFiOTZjZGZkZjgzN2E3MzU1NGZjMjZkYjM1NzA4Y2M=
13
+ NmUzMGI0YmYwODk0NWJjNDJkNDMyNTcxMGVlODg1MjFmY2UxZWMyZjQ1M2Iy
14
+ ZWJmMWFmMmEyMjFjZTM4ZjU5M2I1ZjJlZTU1ZjFlOGJmNDc4NDI4MDBlM2Fh
15
+ OWViMGVkM2E3YzA3ZTdkMjQ3MDE2MGIxNzljMmZmMDFlYTI5NmQ=
data/Gemfile CHANGED
@@ -3,10 +3,10 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
- gem 'rspec', '~> 2.14'
6
+ gem 'rspec', '~> 3.1'
7
7
  gem 'oj', '~> 2.1'
8
- gem 'httparty', '~> 0.11.0'
9
- gem 'paint', '~> 0.8.6'
8
+ gem 'httparty', '~> 0.13'
9
+ gem 'paint', '~> 0.8'
10
10
  gem 'rake', '~> 10.1'
11
11
 
12
12
  # Add dependencies to develop your gem here.
@@ -14,8 +14,9 @@ gem 'rake', '~> 10.1'
14
14
  group :development do
15
15
  gem 'bundler'
16
16
  gem 'jeweler'
17
- gem 'geminabox'
18
17
  gem 'rake-version'
19
18
  gem 'simplecov'
20
19
  gem 'fakefs', require: 'fakefs/safe'
20
+ gem 'rspec-its'
21
+ gem 'rspec-collection_matchers'
21
22
  end
data/README.md CHANGED
@@ -6,14 +6,15 @@
6
6
 
7
7
  ## Requirements
8
8
 
9
- * RSpec 2.14
9
+ * RSpec 3.1 (0.4.0+)
10
+ * *RSpec 2.14 is supported up to version 0.3.1*
10
11
 
11
12
  ## Installation
12
13
 
13
14
  In your Gemfile:
14
15
 
15
16
  ```rb
16
- gem 'rox-client-rspec', '~> 0.3.0'
17
+ gem 'rox-client-rspec', '~> 0.4.0'
17
18
  ```
18
19
 
19
20
  Manually:
@@ -32,7 +33,7 @@ Test keys are assigned to test using RSpec metadata:
32
33
 
33
34
  ```rb
34
35
  it "should work", rox: { key: 'abcdefghijkl' } do
35
- expect(true).to be_true
36
+ expect(true).to be(true)
36
37
  end
37
38
 
38
39
  it(nil, rox: { key: 'bcdefghijklm' }){ should validate_presence_of(:name) }
@@ -41,67 +42,12 @@ it(nil, rox: { key: 'bcdefghijklm' }){ should validate_presence_of(:name) }
41
42
  <a name="setup"></a>
42
43
  ## Setup
43
44
 
44
- ROX clients use [YAML](http://yaml.org) files for configuration.
45
- To use the RSpec ROX Client, you need two configuration files and you must set up the client in your spec helper file.
45
+ You must first set up the configuration file(s) for the project.
46
+ This procedure is described in the [rox-client](https://github.com/lotaris/rox-client) repository:
46
47
 
47
- In your home folder, you must create the `~/.rox/config.yml` configuration file.
48
+ * [ROX Center Client Configuration](https://github.com/lotaris/rox-client#setup-procedure)
48
49
 
49
- ```yml
50
- # List of ROX Center servers you can submit test results to.
51
- servers:
52
- rox.example.com: # A custom name for your ROX Center server.
53
- # You will use this in the client configuration file.
54
- # We recommend using the domain name where you deployed it.
55
-
56
- apiUrl: https://rox.example.com/api # The URL of your ROX Center server's API.
57
- # This is the domain where you deployed it with /api.
58
-
59
- apiKeyId: 39fuc7x85lsoy9c0ek2d # Your user credentials on this server.
60
- apiKeySecret: mwpqvvmagzoegxnqptxdaxkxonjmvrlctwcrfmowibqcpnsdqd
61
-
62
- # If true, test results will be uploaded to ROX Center.
63
- # Set to false to temporarily disable publishing.
64
- # You can change this at runtime from the command line by setting the
65
- # ROX_PUBLISH environment variable to 0 (false) or 1 (true).
66
- publish: true
67
- ```
68
-
69
- In the project directory where you run RSpec, you must add the `rox.yml` client configuration file:
70
-
71
- ```yml
72
- # Configuration specific to your project.
73
- project:
74
- apiId: 154sic93pxs0 # The API key of your project in the ROX Center server.
75
- version: 1.2.3
76
-
77
- # Where the client should store its temporary files.
78
- # The client will work without it but it is required for some advanced features.
79
- workspace: tmp/rox
80
-
81
- # Client advanced features.
82
- payload:
83
-
84
- # Saves a copy of the test payload sent to the ROX Center server for debugging.
85
- # The file will be saved in rspec/servers/<SERVER_NAME>/payload.json.
86
- save: false
87
-
88
- # If you track a large number of tests (more than a thousand), enabling this
89
- # will reduce the size of the test payloads sent to ROX Center server by caching
90
- # test information that doesn't change often such as the name.
91
- cache: false
92
-
93
- # Prints a copy of the test payload sent to the ROX Center server for debugging.
94
- # Temporarily enable at runtime by setting the ROX_PRINT_PAYLOAD environment variable to 1.
95
- print: false
96
-
97
- # The name of the ROX Center server to upload test results to.
98
- # This name must be one of the server names in the ~/.rox/config.yml file.
99
- # You can change this at runtime from the command line by setting the
100
- # ROX_SERVER environment variable.
101
- server: rox.example.com
102
- ```
103
-
104
- Finally, you must enable the client in your spec helper file (usually `spec/spec_helper.rb`).
50
+ You must then enable the client in your spec helper file (e.g. `spec/spec_helper.rb`).
105
51
 
106
52
  ```yml
107
53
  RoxClient::RSpec.configure do |config|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
@@ -4,7 +4,7 @@ require 'rspec'
4
4
  module RoxClient
5
5
 
6
6
  module RSpec
7
- VERSION = '0.3.1'
7
+ VERSION = '0.4.0'
8
8
 
9
9
  class Error < StandardError; end
10
10
  class PayloadError < Error; end
@@ -34,11 +34,11 @@ module RoxClient::RSpec
34
34
  end
35
35
 
36
36
  def known? test_result
37
- @tests[@project_api_id] && !!@tests[@project_api_id][test_result.key]
37
+ !!@tests[@project_api_id] && !!@tests[@project_api_id][test_result.key]
38
38
  end
39
39
 
40
40
  def stale? test_result
41
- @tests[@project_api_id] && test_result_hash(test_result) != @tests[@project_api_id][test_result.key]
41
+ !!@tests[@project_api_id] && test_result_hash(test_result) != @tests[@project_api_id][test_result.key]
42
42
  end
43
43
 
44
44
  private
@@ -18,7 +18,6 @@ module RoxClient::RSpec
18
18
 
19
19
  def process test_run
20
20
 
21
- puts
22
21
  return fail "No server to publish results to" if !@server
23
22
 
24
23
  test_run.uid = @uid.load_uid
@@ -43,6 +42,8 @@ module RoxClient::RSpec
43
42
  save_payload payload if @save_payload
44
43
  print_payload payload if @print_payload
45
44
 
45
+ puts
46
+
46
47
  published
47
48
  end
48
49
 
@@ -4,10 +4,12 @@ require 'rspec/core/formatters/base_formatter'
4
4
 
5
5
  module RoxClient::RSpec
6
6
 
7
- class Formatter < RSpec::Core::Formatters::BaseFormatter
7
+ class Formatter
8
8
 
9
- def initialize *args
10
- super *args
9
+ RSpec::Core::Formatters.register self, :start, :stop, :close,
10
+ :example_group_started, :example_started, :example_passed, :example_failed, :example_group_finished
11
+
12
+ def initialize output
11
13
 
12
14
  config = RoxClient::RSpec.config
13
15
  @client = Client.new config.server, config.client_options
@@ -16,38 +18,38 @@ module RoxClient::RSpec
16
18
  @groups = []
17
19
  end
18
20
 
19
- def start example_count
21
+ def start notification
20
22
  # TODO: measure milliseconds
21
23
  @start_time = Time.now
22
24
  end
23
25
 
24
- def example_group_started group
25
- @groups << group
26
+ def example_group_started group_notification
27
+ @groups << group_notification.group
26
28
  end
27
29
 
28
- def example_group_finished group
30
+ def example_group_finished group_notification
29
31
  @groups.pop
30
32
  end
31
33
 
32
- def example_started example
34
+ def example_started example_notification
33
35
  @current_time = Time.now
34
36
  end
35
37
 
36
- def example_passed example
37
- add_result example, true
38
+ def example_passed example_notification
39
+ add_result example_notification.example, true
38
40
  end
39
41
 
40
- def example_failed example
41
- add_result example, false
42
+ def example_failed example_notification
43
+ add_result example_notification.example, false
42
44
  end
43
45
 
44
- def stop
46
+ def stop notification
45
47
  end_time = Time.now
46
48
  @test_run.end_time = end_time.to_i * 1000
47
49
  @test_run.duration = ((end_time - @start_time) * 1000).round
48
50
  end
49
51
 
50
- def dump_summary duration, example_count, failure_count, pending_count
52
+ def close notification
51
53
  @client.process @test_run
52
54
  end
53
55
 
@@ -2,7 +2,7 @@
2
2
  module RoxClient::RSpec
3
3
 
4
4
  class TestResult
5
- attr_reader :key, :name, :category, :tags, :tickets, :duration, :message
5
+ attr_reader :key, :name, :category, :tags, :tickets, :data, :duration, :message
6
6
 
7
7
  def initialize project, example, groups = [], options = {}
8
8
 
@@ -12,7 +12,7 @@ module RoxClient::RSpec
12
12
 
13
13
  @grouped = extract_grouped example, groups
14
14
 
15
- [ :key, :name, :category, :tags, :tickets ].each do |attr|
15
+ [ :key, :name, :category, :tags, :tickets, :data ].each do |attr|
16
16
  instance_variable_set "@#{attr}".to_sym, send("extract_#{attr}".to_sym, example, groups)
17
17
  end
18
18
 
@@ -51,6 +51,7 @@ module RoxClient::RSpec
51
51
  h['c'] = @category if stale or (first and @category)
52
52
  h['g'] = @tags if stale or (first and !@tags.empty?)
53
53
  h['t'] = @tickets if stale or (first and !@tickets.empty?)
54
+ h['a'] = @data if @data # FIXME: cache custom data
54
55
  end
55
56
  end
56
57
 
@@ -107,6 +108,10 @@ module RoxClient::RSpec
107
108
  (wrap(@tickets) + groups.collect{ |g| wrap meta(g)[:tickets] } + (wrap meta(example)[:tickets])).flatten.compact.uniq.collect(&:to_s)
108
109
  end
109
110
 
111
+ def extract_data example, groups = []
112
+ meta(example)[:data]
113
+ end
114
+
110
115
  def wrap a
111
116
  a.kind_of?(Array) ? a : [ a ]
112
117
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rox-client-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Oulevay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '2.14'
19
+ version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '2.14'
26
+ version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: oj
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 0.11.0
47
+ version: '0.13'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 0.11.0
54
+ version: '0.13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: paint
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.8.6
61
+ version: '0.8'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 0.8.6
68
+ version: '0.8'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: geminabox
112
+ name: rake-version
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ! '>='
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rake-version
126
+ name: simplecov
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ! '>='
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: simplecov
140
+ name: fakefs
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ! '>='
@@ -151,7 +151,21 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: fakefs
154
+ name: rspec-its
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rspec-collection_matchers
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - ! '>='
@@ -208,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
222
  version: '0'
209
223
  requirements: []
210
224
  rubyforge_project:
211
- rubygems_version: 2.1.10
225
+ rubygems_version: 2.2.2
212
226
  signing_key:
213
227
  specification_version: 4
214
228
  summary: RSpec extensions to send results to ROX Center.