sauce-cucumber 2.4.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGU4OWMyYmUxMzc4MjcxMDRmYmNjNTlkZGQ4NGNmZGI3NzRmMGFjNA==
5
+ data.tar.gz: !binary |-
6
+ YzUwZjliMTRiOTBiNWY1OTgyNjE3NTNlMzJiNzg3MjM1ZjgxMjYwNw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTFkZTliZTVmYmUwM2E4ODI2MjgzZDdiZTJiMzlkZjgzOWU1MTUyM2U0ODQ4
10
+ Y2MzZjMzNGE3NjI1YjA5Y2U1ZWVjMmQ0MjAwM2E1MmFjNWFmY2I2MGYwOTVm
11
+ YjA3NGMwNGQyNWM2NmQzNDM2NTlkYmM0YWEyNjJmOTQwMjRiMWQ=
12
+ data.tar.gz: !binary |-
13
+ NjA5OWZhZDQyYmM0OGEyODZiNTJiNzAzMWY1MGY5NjA1Y2MxMDNhODBlMzQx
14
+ NGQwZjE3M2Y0NWExNmMwNmNmOThjNTEzOGE0MjZmNmVkNmNiZGVlNmI0YWQ2
15
+ NDFmZjZmZGI0Mzk4OWQyYTBkNDg2MDc3YjA4OTU5NTA2NWVlMTk=
@@ -2,6 +2,7 @@ require 'capybara'
2
2
  require 'cucumber'
3
3
  require 'sauce/job'
4
4
  require 'sauce/capybara'
5
+ require 'sauce/utilities'
5
6
 
6
7
  module Sauce
7
8
  module Capybara
@@ -23,6 +24,16 @@ module Sauce
23
24
  end
24
25
  module_function :name_from_scenario
25
26
 
27
+ def file_name_from_scenario(scenario)
28
+ if scenario.instance_of? ::Cucumber::Ast::OutlineTable::ExampleRow
29
+ table = scenario.instance_variable_get(:@table)
30
+ outline = table.instance_variable_get(:@scenario_outline)
31
+ return outline.feature.file
32
+ end
33
+ return scenario.location.file
34
+ end
35
+ module_function :file_name_from_scenario
36
+
26
37
  def jenkins_name_from_scenario(scenario)
27
38
  # Special behavior to handle Scenario Outlines
28
39
  if scenario.instance_of? ::Cucumber::Ast::OutlineTable::ExampleRow
@@ -55,11 +66,12 @@ module Sauce
55
66
  module_function :using_jenkins?
56
67
 
57
68
  def around_hook(scenario, block)
69
+ if Sauce::Config.new[:start_tunnel]
70
+ Sauce::Utilities::Connect.start(:quiet => true)
71
+ end
72
+
58
73
  ::Capybara.current_driver = :sauce
59
- driver = ::Capybara.current_session.driver
60
- # This session_id is the job ID used by Sauce Labs, we're pulling it
61
- # off of the driver now to make sure we have it after `block.call`
62
- session_id = driver.browser.session_id
74
+
63
75
  job_name = Sauce::Capybara::Cucumber.name_from_scenario(scenario)
64
76
  custom_data = {}
65
77
 
@@ -69,11 +81,6 @@ module Sauce
69
81
  :jenkins_job => ENV['JOB_NAME']})
70
82
  end
71
83
 
72
- job = Sauce::Job.new('id' => session_id,
73
- 'name' => job_name,
74
- 'custom-data' => custom_data)
75
- job.save unless job.nil?
76
-
77
84
  Sauce.config do |c|
78
85
  c[:name] = Sauce::Capybara::Cucumber.name_from_scenario(scenario)
79
86
  end
@@ -92,15 +99,34 @@ module Sauce
92
99
  output << "job-name=#{Sauce::Capybara::Cucumber.jenkins_name_from_scenario(scenario)}"
93
100
  puts output.join(' ')
94
101
  end
95
-
96
- block.call
97
-
98
- # Quit the driver to allow for the generation of a new session_id
99
- driver.finish!
100
-
101
- unless job.nil?
102
- job.passed = !scenario.failed?
103
- job.save
102
+ filename = file_name_from_scenario(scenario)
103
+ Sauce::Config.new.browsers_for_file("./#{filename}").each do |os, browser, version|
104
+ @selenium = Sauce::Selenium2.new({:os => os,
105
+ :browser => browser,
106
+ :browser_version => version,
107
+ :job_name => job_name})
108
+
109
+ Sauce.driver_pool[Thread.current.object_id] = @selenium
110
+
111
+ driver = ::Capybara.current_session.driver
112
+ # This session_id is the job ID used by Sauce Labs, we're pulling it
113
+ # off of the driver now to make sure we have it after `block.call`
114
+ session_id = driver.browser.session_id
115
+
116
+ job = Sauce::Job.new('id' => session_id,
117
+ 'name' => job_name,
118
+ 'custom-data' => custom_data)
119
+ job.save unless job.nil?
120
+
121
+ block.call
122
+
123
+ # Quit the driver to allow for the generation of a new session_id
124
+ driver.finish!
125
+
126
+ unless job.nil?
127
+ job.passed = !scenario.failed?
128
+ job.save
129
+ end
104
130
  end
105
131
  end
106
132
  module_function :around_hook
@@ -117,5 +143,10 @@ begin
117
143
  Around('@selenium') do |scenario, block|
118
144
  Sauce::Capybara::Cucumber.around_hook(scenario, block)
119
145
  end
146
+
147
+ at_exit do
148
+ Sauce::Utilities::Connect.close
149
+ end
150
+
120
151
  rescue NoMethodError # This makes me sad
121
152
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "sauce-cucumber"
15
15
  gem.require_paths = ["lib"]
16
- gem.version = "#{Sauce::MAJOR_VERSION}.1"
16
+ gem.version = "#{Sauce::MAJOR_VERSION}.0"
17
17
 
18
- gem.add_dependency('sauce', ">= #{Sauce::MAJOR_VERSION}.0")
18
+ gem.add_dependency('sauce', "~> #{Sauce.version}")
19
19
  gem.add_dependency('cucumber', '>= 1.2.0')
20
20
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauce-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
5
- prerelease:
4
+ version: 3.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - R. Tyler Croy
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-11 00:00:00.000000000 Z
11
+ date: 2013-06-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: sauce
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 2.4.0
19
+ version: 3.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 2.4.0
26
+ version: 3.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: cucumber
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -57,32 +52,25 @@ files:
57
52
  - sauce-cucumber.gemspec
58
53
  homepage: ''
59
54
  licenses: []
55
+ metadata: {}
60
56
  post_install_message:
61
57
  rdoc_options: []
62
58
  require_paths:
63
59
  - lib
64
60
  required_ruby_version: !ruby/object:Gem::Requirement
65
- none: false
66
61
  requirements:
67
62
  - - ! '>='
68
63
  - !ruby/object:Gem::Version
69
64
  version: '0'
70
- segments:
71
- - 0
72
- hash: -328413827640150646
73
65
  required_rubygems_version: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
67
  - - ! '>='
77
68
  - !ruby/object:Gem::Version
78
69
  version: '0'
79
- segments:
80
- - 0
81
- hash: -328413827640150646
82
70
  requirements: []
83
71
  rubyforge_project:
84
- rubygems_version: 1.8.25
72
+ rubygems_version: 2.0.3
85
73
  signing_key:
86
- specification_version: 3
74
+ specification_version: 4
87
75
  summary: ''
88
76
  test_files: []