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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 130928ede57f9a40d1b22d0e66f3ed254d614aeb
4
- data.tar.gz: 00dd538d850dee73f4d8a2caf58858845942274c
3
+ metadata.gz: f2f9c9dbcd22da3dd2ba2f4425bdedf75ad38e81
4
+ data.tar.gz: 09b7f4082579620d02cd18ee40a69c478b954c75
5
5
  SHA512:
6
- metadata.gz: 52da99dc9bfd36bf1369d4f0e4069258bdfc4accde72781f6b63b555d2a239faa4472567eec372c5ece35a8ffd844e9705b513aee222734da7f6a9436c942687
7
- data.tar.gz: 76a252ee7416ea06cac3c42743e9ec8b848b2952c788cd85ee0e804739813e887eca56905e2c06b336c19e1809dfff5bd5bd15043ddf9e0d73fcfcea5efb2465
6
+ metadata.gz: 353dfdd453bed887ec481e1e612e6aaf778fdb5343520dcb7336f292c1c4e64cf1a79fc012c78fe067fba81824f25becbe6fcaa9bbde61ae3602527d4bcf05a7
7
+ data.tar.gz: 39c8b407a6640993f972b1a04c2537a8b5f3e5488afde5040fee2e2249c88308bb3e4e4f6eedd2d275455a4b82ee0d9a5fb13c84b1a9e0e3d6bd775d7775c266
@@ -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
- ENV['cucumber_pro_log_path'] = File.dirname(__FILE__) + '/tmp/test.log'
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
- task :cucumber do
11
- sh 'cucumber'
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
- - Allow configuration of remote
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
@@ -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 'thin'
23
+ s.add_development_dependency 'puma'
24
24
  s.add_development_dependency 'rack'
25
25
  s.add_development_dependency 'anticipate'
26
26
 
@@ -23,5 +23,5 @@ Feature: Security
23
23
  Scenario:
24
24
  Given passing
25
25
  """
26
- When I run `cucumber -f Cucumber::Pro -o /dev/null -f pretty`
26
+ When I run `cucumber -f Cucumber::Pro`
27
27
  And the stderr should contain "Missing access token"
@@ -7,5 +7,6 @@ Before do
7
7
  end
8
8
 
9
9
  Before do
10
- @aruba_timeout_seconds = 5
10
+ @aruba_timeout_seconds = (RUBY_PLATFORM =~ /java/) ? 20 : 10
11
11
  end
12
+
@@ -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
- logger = self.logger
23
+ class SocketApp
24
+ def initialize(logger)
25
+ @logger = logger
26
+ end
23
27
 
24
- SocketApp = lambda do |env|
25
- logger.debug [:server, :starting]
26
- ws = Faye::WebSocket.new(env)
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
- ws.on :open do |event|
29
- logger.debug [:server, :open]
30
- end
33
+ logger.debug [:server, :starting]
34
+ ws = Faye::WebSocket.new(env)
31
35
 
32
- ws.on :message do |event|
33
- logger.debug [:server, :message, event.data]
34
- FakeResultsService.messages << JSON.parse(event.data)
35
- ws.send 'ok'
36
- end
36
+ ws.on :open do |event|
37
+ logger.debug [:server, :open]
38
+ end
37
39
 
38
- ws.on :close do |event|
39
- logger.debug [:server, :close]
40
- end
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
- # Return async Rack response
43
- ws.rack_response
44
- end
46
+ ws.on :error do |event|
47
+ logger.debug [:server, :error, event.code, event.reason]
48
+ end
45
49
 
46
- class Security
47
- def initialize(app)
48
- @app = app
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 call(env)
52
- request = Rack::Request.new(env)
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 'thin'
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
- thin = Rack::Handler.get('thin')
68
- app = Security.new(SocketApp)
69
- thin.run app, :Port => PORT
70
- trap("INT") { exit }
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)
@@ -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
- session = WebSocket::Session.new(url, logger(output))
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 logger(output)
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
@@ -1 +1 @@
1
- 0.0.6
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.6
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-18 00:00:00.000000000 Z
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: thin
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.6
192
+ summary: cucumber-pro-0.0.7
193
193
  test_files:
194
194
  - features/publish_results.feature
195
195
  - features/security.feature
@@ -1,9 +0,0 @@
1
- module Cucumber
2
- module Pro
3
- class Version
4
- def self.to_s
5
- "0.0.2"
6
- end
7
- end
8
- end
9
- end