cucumber-pro 0.0.14 → 0.0.15

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: b480901553d723dcc5d4df5f5cbf69556af33d63
4
- data.tar.gz: b4af2756d621c2f543d15dd8b3a97e69718ae5d8
3
+ metadata.gz: 263eba42f9bdf5752a70ddf321e173fb46124ffc
4
+ data.tar.gz: 169aebfa7f2d996db5545b0661488f05bec50d47
5
5
  SHA512:
6
- metadata.gz: db68949da991567d0d4f45e026b17c0960cd2a409f1790b8bbb26781d6ad5e105ca9b4038792410b193348d3bbfa2fdbcb1aa42f302760a02da1674bcc2dc855
7
- data.tar.gz: 469d4188973e72533ef6eb14d812f468ac6f3e6908d8e125c34fd47e54e18defa07fa54d5032daa08c0890fec16264dfe8ce84adae304c632e2c3b3b71642c83
6
+ metadata.gz: de0c85a53cecb8764eb891ca33f370694c1a025c923f2dd2e08c514df1feb0c32f7025f31053742c25f1a5b0fdebe237b7749cddb5637fce40c5ee828c0e7650
7
+ data.tar.gz: 4383cb91d845ed6105e94c3c7a6136f556c2cb9d47c1d9f823bc828a165dacb8e0658cf61127f200127afcb2a4f44a45e274d74d8d450f0d722b0e6d36e122b5
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.15](https://github.com/cucumber-ltd/cucumber-pro-ruby/compare/v0.0.14...v0.0.15) (2014-09-03)
2
+
3
+ * Print server errors to users.
4
+
1
5
  ## [0.0.14](https://github.com/cucumber-ltd/cucumber-pro-ruby/compare/v0.0.13...v0.0.14) (2014-09-02)
2
6
 
3
7
  * Only publish results if we detect a CI environment.
@@ -1 +1 @@
1
- default: --format Cucumber::Pro --out /dev/null
1
+ default: --format pretty --format Cucumber::Pro --out /dev/null
@@ -1,6 +1,7 @@
1
1
  require 'faye/websocket'
2
2
  require 'json'
3
3
  require 'logger'
4
+ require 'cucumber/pro'
4
5
 
5
6
  module FakeResultsService
6
7
  PORT = 5000
@@ -20,7 +21,7 @@ module FakeResultsService
20
21
  end
21
22
  end
22
23
 
23
- class SocketApp
24
+ class SocketApp
24
25
  def initialize(logger)
25
26
  @logger = logger
26
27
  end
@@ -40,7 +41,7 @@ module FakeResultsService
40
41
  ws.on :message do |event|
41
42
  logger.debug [:server, :message, event.data]
42
43
  FakeResultsService.messages << JSON.parse(event.data)
43
- ws.send 'ok'
44
+ ws.send '{}'
44
45
  end
45
46
 
46
47
  ws.on :error do |event|
@@ -71,7 +72,7 @@ module FakeResultsService
71
72
  server = Puma::Server.new(app, events)
72
73
  server.binder = binder
73
74
  server.run
74
- trap("INT") do
75
+ trap("INT") do
75
76
  puts "Stopping..."
76
77
  server.stop(true)
77
78
  EM.stop_event_loop
@@ -90,7 +91,13 @@ module FakeResultsService
90
91
  $em = Thread.new do
91
92
  begin
92
93
  failing_after(3).tries do
93
- EM.run &run_em_server
94
+ begin
95
+ EM.run &run_em_server
96
+ rescue Cucumber::Pro::Error::ServerError => exception
97
+ logger.fatal(exception)
98
+ $stderr.puts exception, exception.backtrace
99
+ exit 1
100
+ end
94
101
  end
95
102
  rescue => exception
96
103
  logger.fatal(exception)
@@ -12,7 +12,7 @@ module Cucumber
12
12
  working_copy = Scm::WorkingCopy.detect
13
13
 
14
14
  if should_publish
15
- working_copy.check_clean
15
+ working_copy.check_clean if config.should_check_clean
16
16
  session = WebSocket::Session.new(url, logger, timeout: config.timeout)
17
17
  else
18
18
  session = WebSocket::NullSession.new
@@ -52,7 +52,7 @@ module Cucumber
52
52
  end
53
53
 
54
54
  class Config
55
- attr_accessor :url, :logger, :token, :should_publish, :timeout, :build_number
55
+ attr_accessor :url, :logger, :token, :should_publish, :should_check_clean,:timeout, :build_number
56
56
  end
57
57
 
58
58
  # Default config
@@ -61,6 +61,7 @@ module Cucumber
61
61
  config.token = ENV['CUCUMBER_PRO_TOKEN']
62
62
  config.build_number = ENV['BUILD_NUMBER'] || ENV['CIRCLE_BUILD_NUM'] || ENV['TRAVIS_JOB_NUMBER'] || ENV['bamboo.buildNumber'] || ENV['CI_BUILD_NUMBER']
63
63
  config.should_publish = config.token && (config.build_number || ENV['CI'])
64
+ config.should_check_clean = ENV['CUCUMBER_PRO_IGNORE_DIRTY'].nil?
64
65
  config.timeout = 5
65
66
  if file = ENV['CUCUMBER_PRO_LOG_FILE']
66
67
  config.logger = Logger.new(file)
@@ -13,6 +13,8 @@ module Cucumber
13
13
  super "Timed out waiting for a reply from the Cucumber Pro server."
14
14
  end
15
15
  }
16
+
17
+ ServerError = Class.new(StandardError)
16
18
  end
17
19
 
18
20
  end
@@ -1 +1 @@
1
- 0.0.14
1
+ 0.0.15
@@ -135,6 +135,10 @@ module Cucumber
135
135
  def on_message(event)
136
136
  logger.debug [:ws, :message, event.data]
137
137
  @ack_count -= 1
138
+ message = JSON.parse(event.data)
139
+ if(message['error'])
140
+ raise Error::ServerError.new(message['error'])
141
+ end
138
142
  self
139
143
  end
140
144
 
@@ -37,7 +37,25 @@ module Cucumber::Pro
37
37
  end
38
38
  end
39
39
 
40
- it "throws an error if the server responds with an error"
40
+ it "throws an error if the server responds with an error" do
41
+ worker.send(good_data)
42
+ worker.close
43
+ eventually do
44
+ expect(socket.data.last).to eq good_data
45
+ end
46
+ eventually do
47
+ expect( worker ).to_not be_closed
48
+ end
49
+ begin
50
+ socket.send_error
51
+ fail
52
+ rescue => expected
53
+ expect(expected.message).to eq('an error happened on the server')
54
+ eventually do
55
+ expect( worker ).to be_closed
56
+ end
57
+ end
58
+ end
41
59
 
42
60
  def create_fake_socket(worker)
43
61
  socket.worker = worker
@@ -72,6 +90,11 @@ module Cucumber::Pro
72
90
  worker.method(:on_message).call(event)
73
91
  end
74
92
 
93
+ def send_error
94
+ event = ws_event(1000, { 'error' => 'an error happened on the server' })
95
+ worker.method(:on_message).call(event)
96
+ end
97
+
75
98
  def data
76
99
  @data ||= []
77
100
  while !@q.empty?
@@ -83,7 +106,7 @@ module Cucumber::Pro
83
106
  private
84
107
 
85
108
  def ws_event(code, data = {})
86
- double('ws event', code: 1000, data: data)
109
+ double('ws event', code: 1000, data: data.to_json)
87
110
  end
88
111
 
89
112
  end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
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-09-02 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.7'
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
26
  version: '0.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.3.5
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.3.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.9.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.9.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.14.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.14.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aruba
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: puma
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rack
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: anticipate
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: Client library for publishing results to the Cucumber Pro service
@@ -142,8 +142,8 @@ executables: []
142
142
  extensions: []
143
143
  extra_rdoc_files: []
144
144
  files:
145
- - .rspec
146
- - .travis.yml
145
+ - ".rspec"
146
+ - ".travis.yml"
147
147
  - CONTRIBUTING.md
148
148
  - Gemfile
149
149
  - HISTORY.md
@@ -176,17 +176,17 @@ licenses:
176
176
  metadata: {}
177
177
  post_install_message:
178
178
  rdoc_options:
179
- - --charset=UTF-8
179
+ - "--charset=UTF-8"
180
180
  require_paths:
181
181
  - lib
182
182
  required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - '>='
184
+ - - ">="
185
185
  - !ruby/object:Gem::Version
186
186
  version: 1.9.3
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - '>='
189
+ - - ">="
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
@@ -194,7 +194,7 @@ rubyforge_project:
194
194
  rubygems_version: 2.0.14
195
195
  signing_key:
196
196
  specification_version: 4
197
- summary: cucumber-pro-0.0.14
197
+ summary: cucumber-pro-0.0.15
198
198
  test_files:
199
199
  - features/publish_results.feature
200
200
  - features/security.feature
@@ -206,3 +206,4 @@ test_files:
206
206
  - spec/cucumber/pro/info_spec.rb
207
207
  - spec/cucumber/pro/scm/git_working_copy_spec.rb
208
208
  - spec/cucumber/pro/web_socket/worker_spec.rb
209
+ has_rdoc: