cucumber-pro 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/README.md +4 -1
- data/Rakefile +9 -3
- data/TODO.md +4 -2
- data/cucumber-pro.gemspec +1 -1
- data/features/security.feature +1 -1
- data/features/support/aruba.rb +2 -1
- data/features/support/env.rb +10 -0
- data/features/support/fake_results_service.rb +51 -34
- data/lib/cucumber/pro.rb +17 -8
- data/lib/cucumber/pro/formatter.rb +4 -2
- data/lib/cucumber/pro/version +1 -1
- metadata +5 -5
- data/lib/cucumber/pro/version.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f9c9dbcd22da3dd2ba2f4425bdedf75ad38e81
|
4
|
+
data.tar.gz: 09b7f4082579620d02cd18ee40a69c478b954c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 353dfdd453bed887ec481e1e612e6aaf778fdb5343520dcb7336f292c1c4e64cf1a79fc012c78fe067fba81824f25becbe6fcaa9bbde61ae3602527d4bcf05a7
|
7
|
+
data.tar.gz: 39c8b407a6640993f972b1a04c2537a8b5f3e5488afde5040fee2e2249c88308bb3e4e4f6eedd2d275455a4b82ee0d9a5fb13c84b1a9e0e3d6bd775d7775c266
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
rvm:
|
2
|
+
- 2.1.0
|
3
|
+
- 2.0.0
|
4
|
+
- 1.9.3
|
5
|
+
- jruby
|
6
|
+
notifications:
|
7
|
+
email:
|
8
|
+
- hello@cucumber.pro
|
9
|
+
env:
|
10
|
+
global:
|
11
|
+
secure: GTHou5Qwb0p/hx7pQNg004oZ/PHatnKRQJSjJ0/M6D0REgnd2zVuYD2W6lvFqH5ego5c5+Kcrv8l9f6Iq1XXXotdjN3TiNQhnzbiw/ShEYSNH9HTwRFjJ307nOSRSfyYE2uMUeRnrtowdg2H0W+CG630g9VOnipDAqWm+g7IU0A=
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Cucumber Pro Client Gem
|
2
|
+
[![Build Status](https://travis-ci.org/cucumber-ltd/cucumber-pro-ruby.svg?branch=master)](https://travis-ci.org/cucumber-ltd/cucumber-pro-ruby.svg?branch=master)
|
2
3
|
|
3
4
|
This gem provides a formatter for Cucumber that publishes results to
|
4
5
|
the [Cucumber Pro](https://cucumber.pro) web service.
|
@@ -14,6 +15,8 @@ gem 'cucumber-pro'
|
|
14
15
|
Now run Cucumber using the `Cucumber::Pro` formatter:
|
15
16
|
|
16
17
|
```
|
17
|
-
CUCUMBER_PRO_TOKEN=<your auth token> cucumber -f Cucumber::Pro -f pretty
|
18
|
+
CUCUMBER_PRO_TOKEN=<your auth token> cucumber -f Cucumber::Pro -o /dev/null -f pretty
|
18
19
|
```
|
19
20
|
|
21
|
+
This will set up a connection to the Cucumber Pro server and stream results as your tests run. If you want to see debug output, replace `/dev/null` with the path to a log file.
|
22
|
+
|
data/Rakefile
CHANGED
@@ -5,10 +5,16 @@ Bundler::GemHelper.install_tasks
|
|
5
5
|
desc 'Run tests'
|
6
6
|
task default: [:rspec, :cucumber]
|
7
7
|
|
8
|
-
|
8
|
+
# Because https://github.com/eventmachine/eventmachine/issues/34
|
9
|
+
if ENV['TRAVIS'] && RUBY_PLATFORM =~ /java/
|
10
|
+
ENV['CUCUMBER_PRO_URL']="ws://results.cucumber.pro/ws"
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
require 'cucumber/rake/task'
|
14
|
+
Cucumber::Rake::Task.new do |t|
|
15
|
+
t.cucumber_opts = ""
|
16
|
+
t.cucumber_opts = "--format Cucumber::Pro --out cucumber-pro.log" if ENV['CUCUMBER_PRO_TOKEN']
|
17
|
+
t.cucumber_opts << "--format pretty"
|
12
18
|
end
|
13
19
|
|
14
20
|
task :rspec do
|
data/TODO.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
- Unit tests for Messaging
|
2
2
|
- Handle cases where some messages sent are not ack'd
|
3
3
|
- Handle cases where some messages sent come back with an error
|
4
|
-
-
|
5
|
-
|
4
|
+
- e.g. upgrade your client error
|
5
|
+
- Allow configuration of git remote
|
6
|
+
- Build against Cucumber 2.0 and 1.3.x
|
7
|
+
- SVN support
|
data/cucumber-pro.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_development_dependency 'rspec', '>= 2.14.1'
|
21
21
|
s.add_development_dependency 'cucumber'
|
22
22
|
s.add_development_dependency 'aruba'
|
23
|
-
s.add_development_dependency '
|
23
|
+
s.add_development_dependency 'puma'
|
24
24
|
s.add_development_dependency 'rack'
|
25
25
|
s.add_development_dependency 'anticipate'
|
26
26
|
|
data/features/security.feature
CHANGED
data/features/support/aruba.rb
CHANGED
data/features/support/env.rb
CHANGED
@@ -1,2 +1,12 @@
|
|
1
1
|
$logger = Logger.new(ENV['cucumber_pro_log_path'] || STDOUT)
|
2
2
|
$logger.debug '--- starting tests ---'
|
3
|
+
|
4
|
+
# For some reason JRuby / ChildProcess won't let us delete an environment variable,
|
5
|
+
# but it will let us overwrite it, so we make do with that.
|
6
|
+
Before do
|
7
|
+
if RUBY_PLATFORM =~ /java/
|
8
|
+
set_env 'CUCUMBER_PRO_TOKEN', ''
|
9
|
+
else
|
10
|
+
ENV.delete('CUCUMBER_PRO_TOKEN')
|
11
|
+
end
|
12
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'faye/websocket'
|
2
2
|
require 'json'
|
3
|
+
require 'logger'
|
3
4
|
|
4
5
|
module FakeResultsService
|
5
6
|
PORT = 5000
|
@@ -15,59 +16,75 @@ module FakeResultsService
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def logger
|
18
|
-
$logger
|
19
|
+
$logger || Logger.new(STDOUT)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
|
+
class SocketApp
|
24
|
+
def initialize(logger)
|
25
|
+
@logger = logger
|
26
|
+
end
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
def call(env)
|
29
|
+
request = Rack::Request.new(env)
|
30
|
+
params = request.params
|
31
|
+
return [401, [], {}] unless params['token'] == VALID_TOKEN
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
end
|
33
|
+
logger.debug [:server, :starting]
|
34
|
+
ws = Faye::WebSocket.new(env)
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
ws.send 'ok'
|
36
|
-
end
|
36
|
+
ws.on :open do |event|
|
37
|
+
logger.debug [:server, :open]
|
38
|
+
end
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
ws.on :message do |event|
|
41
|
+
logger.debug [:server, :message, event.data]
|
42
|
+
FakeResultsService.messages << JSON.parse(event.data)
|
43
|
+
ws.send 'ok'
|
44
|
+
end
|
41
45
|
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
ws.on :error do |event|
|
47
|
+
logger.debug [:server, :error, event.code, event.reason]
|
48
|
+
end
|
45
49
|
|
46
|
-
|
47
|
-
|
48
|
-
|
50
|
+
ws.on :close do |event|
|
51
|
+
logger.debug [:server, :close]
|
52
|
+
end
|
53
|
+
|
54
|
+
# Return async Rack response
|
55
|
+
ws.rack_response
|
49
56
|
end
|
50
57
|
|
51
|
-
def
|
52
|
-
|
53
|
-
params = request.params
|
54
|
-
return [401, [], {}] unless params['token'] == VALID_TOKEN
|
55
|
-
@app.call(env)
|
58
|
+
def log(message)
|
59
|
+
logger.debug(message)
|
56
60
|
end
|
61
|
+
|
62
|
+
attr_reader :logger
|
63
|
+
private :logger
|
57
64
|
end
|
58
65
|
|
59
|
-
require '
|
66
|
+
require 'puma'
|
60
67
|
require 'rack'
|
61
68
|
require 'eventmachine'
|
62
|
-
Faye::WebSocket.load_adapter 'thin'
|
63
|
-
Thin::Logging.logger = logger
|
64
69
|
$em = Thread.new do
|
65
70
|
begin
|
66
71
|
EM.run do
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
72
|
+
app = SocketApp.new(FakeResultsService.logger)
|
73
|
+
events = Puma::Events.new(StringIO.new, StringIO.new)
|
74
|
+
binder = Puma::Binder.new(events)
|
75
|
+
binder.parse(["tcp://0.0.0.0:#{PORT}"], app)
|
76
|
+
server = Puma::Server.new(app, events)
|
77
|
+
server.binder = binder
|
78
|
+
server.run
|
79
|
+
trap("INT") do
|
80
|
+
puts "Stopping..."
|
81
|
+
server.stop(true)
|
82
|
+
EM.stop_event_loop
|
83
|
+
exit
|
84
|
+
end
|
85
|
+
at_exit do
|
86
|
+
server.stop(true)
|
87
|
+
end
|
71
88
|
end
|
72
89
|
rescue => exception
|
73
90
|
logger.fatal(exception)
|
data/lib/cucumber/pro.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'cucumber/pro/formatter'
|
3
3
|
require 'cucumber/pro/web_socket/session'
|
4
|
-
require 'cucumber/pro/version'
|
5
4
|
|
6
5
|
module Cucumber
|
7
6
|
module Pro
|
8
7
|
|
9
8
|
class << self
|
10
9
|
def new(runtime, output, options)
|
11
|
-
|
10
|
+
create_logger(output)
|
11
|
+
session = WebSocket::Session.new(url, logger)
|
12
12
|
Formatter.new(session)
|
13
13
|
end
|
14
14
|
|
@@ -18,17 +18,25 @@ module Cucumber
|
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
+
attr_reader :logger
|
22
|
+
private :logger
|
23
|
+
|
21
24
|
def config
|
22
25
|
@config ||= Config.new
|
23
26
|
end
|
24
27
|
|
25
28
|
def url
|
26
|
-
token = config.token || raise(Error::MissingToken.new)
|
27
29
|
config.url + "?token=#{token}"
|
28
30
|
end
|
29
31
|
|
30
|
-
def
|
31
|
-
config.logger || Logger.new(output)
|
32
|
+
def create_logger(output)
|
33
|
+
@logger = config.logger || Logger.new(output)
|
34
|
+
end
|
35
|
+
|
36
|
+
def token
|
37
|
+
result = (config.token || '')
|
38
|
+
raise(Error::MissingToken.new) if result.empty?
|
39
|
+
result
|
32
40
|
end
|
33
41
|
end
|
34
42
|
|
@@ -38,8 +46,11 @@ module Cucumber
|
|
38
46
|
|
39
47
|
# Default config
|
40
48
|
configure do |config|
|
41
|
-
config.url = 'wss://results.cucumber.pro/ws'
|
49
|
+
config.url = ENV['CUCUMBER_PRO_URL'] || 'wss://results.cucumber.pro/ws'
|
42
50
|
config.token = ENV['CUCUMBER_PRO_TOKEN']
|
51
|
+
ENV['cucumber_pro_log_path'].tap do |path|
|
52
|
+
config.logger = Logger.new(path) if path
|
53
|
+
end
|
43
54
|
end
|
44
55
|
|
45
56
|
module Error
|
@@ -58,5 +69,3 @@ module Cucumber
|
|
58
69
|
|
59
70
|
end
|
60
71
|
end
|
61
|
-
|
62
|
-
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'cucumber/pro/scm'
|
2
|
+
require 'cucumber/pro/info'
|
2
3
|
require 'securerandom'
|
3
4
|
|
4
5
|
module Cucumber
|
@@ -57,7 +58,8 @@ module Cucumber
|
|
57
58
|
repo_url: scm.remote,
|
58
59
|
branch: scm.branch,
|
59
60
|
rev: scm.rev,
|
60
|
-
group: get_run_id
|
61
|
+
group: get_run_id,
|
62
|
+
info: Info.new.to_h
|
61
63
|
})
|
62
64
|
end
|
63
65
|
|
@@ -80,7 +82,7 @@ module Cucumber
|
|
80
82
|
end
|
81
83
|
|
82
84
|
def get_run_id
|
83
|
-
SecureRandom.hex
|
85
|
+
SecureRandom.hex
|
84
86
|
end
|
85
87
|
|
86
88
|
end
|
data/lib/cucumber/pro/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wynne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faye-websocket
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: puma
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -143,6 +143,7 @@ extensions: []
|
|
143
143
|
extra_rdoc_files: []
|
144
144
|
files:
|
145
145
|
- ".rspec"
|
146
|
+
- ".travis.yml"
|
146
147
|
- Gemfile
|
147
148
|
- LICENSE
|
148
149
|
- README.md
|
@@ -160,7 +161,6 @@ files:
|
|
160
161
|
- lib/cucumber/pro/formatter.rb
|
161
162
|
- lib/cucumber/pro/scm.rb
|
162
163
|
- lib/cucumber/pro/version
|
163
|
-
- lib/cucumber/pro/version.rb
|
164
164
|
- lib/cucumber/pro/web_socket/session.rb
|
165
165
|
- spec/cucumber/pro/scm/git_repo_spec.rb
|
166
166
|
- spec/cucumber/pro/web_socket/worker_spec.rb
|
@@ -189,7 +189,7 @@ rubyforge_project:
|
|
189
189
|
rubygems_version: 2.0.14
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
|
-
summary: cucumber-pro-0.0.
|
192
|
+
summary: cucumber-pro-0.0.7
|
193
193
|
test_files:
|
194
194
|
- features/publish_results.feature
|
195
195
|
- features/security.feature
|