cucumber-pro 0.0.12 → 0.0.13

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: 4c1ea22ade2589bfaba0ea2b8b452133995630c9
4
- data.tar.gz: 31a0837902dfacd353adf063083d2a5c6d9d1681
3
+ metadata.gz: 35dcec69d5a9599d4d30a57ba1edc2d3a7a0d636
4
+ data.tar.gz: b0b5af3ce80e5f81180ecf337a35ababbd919933
5
5
  SHA512:
6
- metadata.gz: 3ba8796ca612b363c444fb9308687d6dfdcc66e0620eb2d197e9461dacec93bb019cb2a5d13d9621d62753ac70113bc09b66183a02d528d4bc71e22c02b2a401
7
- data.tar.gz: 4f3a0bf99cdd27ac75142da244443a1f5378b03e36cf66be3a2fed14db919d82d4fa5110635600b2a85d749bd0c79a74f8db810fd3503cd8b863dfcf7d197149
6
+ metadata.gz: ed859c503bdd207631bc765d19c3432694c0434bc75637428bf8f8b5baf0f7c957411f59054db35459b89108f90e7c0605b1cc4edb15938c942ab0570b2d6c93
7
+ data.tar.gz: 4f5b098807e4539ba050640fbf354e28b0d1fa63f326faa1471e213e5e5668c4f9c4207f38e8e3730e7afad22137c191687cb21f94584fe44a6d91c6eb442d40
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ end
13
13
  require 'cucumber/rake/task'
14
14
  Cucumber::Rake::Task.new do |t|
15
15
  t.cucumber_opts = ""
16
- t.cucumber_opts = "--format Cucumber::Pro --out cucumber-pro.log" if ENV['CUCUMBER_PRO_TOKEN']
16
+ t.cucumber_opts = "--format Cucumber::Pro --out cucumber-pro.log"
17
17
  t.cucumber_opts << "--format pretty"
18
18
  end
19
19
 
@@ -14,14 +14,3 @@ Feature: Security
14
14
  | CUCUMBER_PRO_TOKEN | invalid-token |
15
15
  And I run `cucumber -f Cucumber::Pro -o /dev/null -f pretty`
16
16
  And the stderr should contain "Access denied"
17
-
18
- Scenario: No access token
19
- Given a git repo
20
- And a feature "features/test.feature" with:
21
- """
22
- Feature:
23
- Scenario:
24
- Given passing
25
- """
26
- When I run `cucumber -f Cucumber::Pro`
27
- And the stderr should contain "Missing access token"
@@ -15,7 +15,13 @@ Given(/^a git repo$/) do
15
15
  run_simple "git config user.name \"Test user\""
16
16
  run_simple "git commit --allow-empty -m 'Initial commit'"
17
17
  run_simple "git remote add origin #{repo_url}"
18
- run_simple "git config --get remote.origin.url"
18
+ # TODO: this is an experiment to fix flickering build on CI. May not be required.
19
+ # wait for the git repo to be created before continuing
20
+ eventually do
21
+ run "git config --get remote.origin.url" do |process|
22
+ expect(process.output.strip).to eq repo_url
23
+ end
24
+ end
19
25
  end
20
26
 
21
27
  Given(/^a feature "(.*?)" with:$/) do |path, content|
@@ -24,9 +30,9 @@ end
24
30
 
25
31
  Then(/^the results service should receive a header$/) do
26
32
  eventually do
27
- results_service.messages.length.should > 0
33
+ expect(results_service.messages.length).to be > 0
28
34
  end
29
- results_service.messages.first['repo_url'].should == repo_url
35
+ expect(results_service.messages.first['repo_url']).to eq repo_url
30
36
  end
31
37
 
32
38
  Then(/^the results service should receive these ([\w\-]+) results:$/) do |type, results|
@@ -63,28 +63,34 @@ module FakeResultsService
63
63
  private :logger
64
64
  end
65
65
 
66
+ run_em_server = -> {
67
+ app = SocketApp.new(FakeResultsService.logger)
68
+ events = Puma::Events.new(StringIO.new, StringIO.new)
69
+ binder = Puma::Binder.new(events)
70
+ binder.parse(["tcp://0.0.0.0:#{PORT}"], app)
71
+ server = Puma::Server.new(app, events)
72
+ server.binder = binder
73
+ server.run
74
+ trap("INT") do
75
+ puts "Stopping..."
76
+ server.stop(true)
77
+ EM.stop_event_loop
78
+ exit
79
+ end
80
+ at_exit do
81
+ server.stop(true)
82
+ end
83
+ }
84
+
66
85
  require 'puma'
67
86
  require 'rack'
68
87
  require 'eventmachine'
88
+ require 'anticipate'
89
+ extend Anticipate
69
90
  $em = Thread.new do
70
91
  begin
71
- EM.run do
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
92
+ failing_after(3).tries do
93
+ EM.run &run_em_server
88
94
  end
89
95
  rescue => exception
90
96
  logger.fatal(exception)
@@ -5,12 +5,20 @@ require 'cucumber/pro/errors'
5
5
 
6
6
  module Cucumber
7
7
  module Pro
8
-
9
8
  class << self
10
9
  def new(runtime, output, options)
11
10
  create_logger(output)
12
- session = WebSocket::Session.new(url, logger, timeout: config.timeout)
13
- Formatter.new(session)
11
+
12
+ working_copy = Scm::WorkingCopy.detect
13
+
14
+ if token
15
+ working_copy.check_clean
16
+ session = WebSocket::Session.new(url, logger, timeout: config.timeout)
17
+ else
18
+ session = WebSocket::NullSession.new
19
+ end
20
+
21
+ Formatter.new(session, working_copy)
14
22
  end
15
23
 
16
24
  def configure
@@ -35,9 +43,7 @@ module Cucumber
35
43
  end
36
44
 
37
45
  def token
38
- result = (config.token || '')
39
- raise(Error::MissingToken.new) if result.empty?
40
- result
46
+ config.token
41
47
  end
42
48
  end
43
49
 
@@ -8,12 +8,6 @@ module Cucumber
8
8
  end
9
9
  }
10
10
 
11
- MissingToken = Class.new(StandardError) {
12
- def initialize
13
- super "Missing access token. Please visit https://app.cucumber.pro/my/profile for instructions."
14
- end
15
- }
16
-
17
11
  Timeout = Class.new(StandardError) {
18
12
  def initialize
19
13
  super "Timed out waiting for a reply from the Cucumber Pro server."
@@ -6,8 +6,9 @@ module Cucumber
6
6
  module Pro
7
7
 
8
8
  class Formatter
9
- def initialize(session)
9
+ def initialize(session, working_copy)
10
10
  @session = session
11
+ @working_copy = working_copy
11
12
  send_header
12
13
  end
13
14
 
@@ -53,19 +54,17 @@ module Cucumber
53
54
  private
54
55
 
55
56
  def send_header
56
- working_copy = Scm::WorkingCopy.detect
57
- working_copy.check_clean
58
- @session.send({
59
- repo_url: working_copy.repo_url,
60
- branch: working_copy.branch,
61
- rev: working_copy.rev,
57
+ @session.send_message({
58
+ repo_url: @working_copy.repo_url,
59
+ branch: @working_copy.branch,
60
+ rev: @working_copy.rev,
62
61
  group: get_run_id,
63
62
  info: Info.new.to_h
64
63
  })
65
64
  end
66
65
 
67
66
  def send_step_result(path, line, status)
68
- @session.send({
67
+ @session.send_message({
69
68
  path: path,
70
69
  location: line.to_i,
71
70
  mime_type: 'application/vnd.cucumber.test-step-result+json',
@@ -74,7 +73,7 @@ module Cucumber
74
73
  end
75
74
 
76
75
  def send_test_case_result(path, line, status)
77
- @session.send({
76
+ @session.send_message({
78
77
  path: path,
79
78
  location: line.to_i,
80
79
  mime_type: 'application/vnd.cucumber-pro.test-case-result+json',
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
@@ -6,6 +6,13 @@ require 'cucumber/pro/errors'
6
6
  module Cucumber
7
7
  module Pro
8
8
  module WebSocket
9
+ class NullSession
10
+ def send_message(message)
11
+ end
12
+
13
+ def close
14
+ end
15
+ end
9
16
 
10
17
  class Session
11
18
 
@@ -23,7 +30,7 @@ module Cucumber
23
30
  @socket = Worker.new(create_socket, logger, self, options)
24
31
  end
25
32
 
26
- def send(message)
33
+ def send_message(message)
27
34
  logger.debug [:session, :send, message]
28
35
  socket.send(message.to_json)
29
36
  self
@@ -17,7 +17,7 @@ module Cucumber::Pro
17
17
  worker.send(good_data)
18
18
  worker.close
19
19
  eventually do
20
- socket.data.last.should == good_data
20
+ expect(socket.data.last).to eq good_data
21
21
  end
22
22
  eventually do
23
23
  expect( worker ).to_not be_closed
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.12
4
+ version: 0.0.13
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-06-13 00:00:00.000000000 Z
11
+ date: 2014-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket
@@ -191,7 +191,7 @@ rubyforge_project:
191
191
  rubygems_version: 2.0.14
192
192
  signing_key:
193
193
  specification_version: 4
194
- summary: cucumber-pro-0.0.12
194
+ summary: cucumber-pro-0.0.13
195
195
  test_files:
196
196
  - features/publish_results.feature
197
197
  - features/security.feature