sauce 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ configuration, which you can tweak inside the `Sauce.config` block if necessary.
25
25
 
26
26
  ### Example RSpec test for Rails
27
27
 
28
- Here's an example test for RSpec. Drop something like this in spec/selenium/example.rb:
28
+ Here's an example test for RSpec. Drop something like this in spec/selenium/example.rb. (Because of the way RSpec categorizes tests, the "spec/selenium" directory tree is required for the integration to work properly):
29
29
 
30
30
  require "spec_helper"
31
31
 
@@ -64,7 +64,7 @@ First, configure with your account info:
64
64
 
65
65
  `sauce config USERNAME ACCESS_KEY`
66
66
 
67
- And here's an example test:
67
+ And here's an example test. Drop something like this in spec/selenium/example.rb. (Because of the way RSpec categorizes tests, the "spec/selenium" directory tree is required for the integration to work properly):
68
68
 
69
69
  #!/usr/bin/env ruby
70
70
  #
@@ -1,19 +1,23 @@
1
1
  require 'capybara'
2
+ require 'uri'
3
+
4
+ $uri = URI.parse Capybara.app_host || ""
2
5
 
3
6
  module Sauce
4
7
  module Capybara
5
- class Driver < ::Capybara::Driver::Selenium
8
+ class Driver < ::Capybara::Selenium::Driver
6
9
  def browser
7
10
  unless @browser
8
11
  puts "[Connecting to Sauce OnDemand...]"
9
12
  config = Sauce::Config.new
10
13
  @domain = "#{rand(10000)}.test"
11
- @sauce_tunnel = Sauce::Connect.new(:host => "127.0.0.1",
12
- :port => rack_server.port,
14
+ @sauce_tunnel = Sauce::Connect.new(:host => $uri.host || rack_server.host,
15
+ :port => $uri.port || rack_server.port,
13
16
  :domain => @domain,
14
17
  :quiet => true)
15
18
  @sauce_tunnel.wait_until_ready
16
- @browser = Sauce::Selenium2.new(:name => "Capybara", :browser_url => "http://#{@domain}")
19
+ @browser = Sauce::Selenium2.new(:name => "Capybara test",
20
+ :browser_url => "http://#{@domain}")
17
21
  at_exit do
18
22
  @browser.quit
19
23
  @sauce_tunnel.disconnect
@@ -81,8 +81,9 @@ module Sauce
81
81
  'name' => @opts[:name] || @opts[:job_name]}
82
82
 
83
83
  SAUCE_OPTIONS.each do |opt|
84
- opt = opt.to_sym
85
- browser_options[opt] = @opts[opt] if @opts.include? opt
84
+ [opt, opt.gsub("-", "_")].map(&:to_sym).each do |sym|
85
+ browser_options[opt] = @opts[sym] if @opts.include? sym
86
+ end
86
87
  end
87
88
  return browser_options.to_json
88
89
  end
@@ -72,31 +72,33 @@ if defined?(RSpec::Core::RakeTask)
72
72
  end
73
73
  end
74
74
 
75
- namespace :test do
76
- namespace :selenium do
77
- desc "Run the Selenium acceptance tests in test/selenium using Sauce OnDemand"
78
- task :sauce do
79
- Rake::Task["test:selenium:runtests"].invoke
80
- end
81
-
82
- desc "Run the Selenium acceptance tests in spec/selenium using a local Selenium server"
83
- task :local do
84
- with_selenium_rc do
75
+ if defined?(Rake::TestTask)
76
+ namespace :test do
77
+ namespace :selenium do
78
+ desc "Run the Selenium acceptance tests in test/selenium using Sauce OnDemand"
79
+ task :sauce do
85
80
  Rake::Task["test:selenium:runtests"].invoke
86
81
  end
87
- end
88
82
 
89
- Rake::TestTask.new(:runtests) do |t|
90
- t.libs << "test"
91
- test_glob = ENV["SAUCE_TEST_GLOB"] || "test/selenium/**/*_test.rb"
92
- t.pattern = test_glob
93
- t.verbose = true
83
+ desc "Run the Selenium acceptance tests in spec/selenium using a local Selenium server"
84
+ task :local do
85
+ with_selenium_rc do
86
+ Rake::Task["test:selenium:runtests"].invoke
87
+ end
88
+ end
89
+
90
+ Rake::TestTask.new(:runtests) do |t|
91
+ t.libs << "test"
92
+ test_glob = ENV["SAUCE_TEST_GLOB"] || "test/selenium/**/*_test.rb"
93
+ t.pattern = test_glob
94
+ t.verbose = true
95
+ end
96
+ # Hide it from rake -T
97
+ Rake::Task['test:selenium:runtests'].instance_variable_set(:@full_comment, nil)
98
+ Rake::Task['test:selenium:runtests'].instance_variable_set(:@comment, nil)
99
+ Rake::Task['test:selenium:runtests'].enhance(["db:test:prepare"])
94
100
  end
95
- # Hide it from rake -T
96
- Rake::Task['test:selenium:runtests'].instance_variable_set(:@full_comment, nil)
97
- Rake::Task['test:selenium:runtests'].instance_variable_set(:@comment, nil)
98
- Rake::Task['test:selenium:runtests'].enhance(["db:test:prepare"])
99
- end
100
101
 
101
- task :selenium => "selenium:sauce"
102
+ task :selenium => "selenium:sauce"
103
+ end
102
104
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{sauce}
5
- s.version = "1.0.1"
5
+ s.version = "1.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Eric Allen", "Sean Grove", "Steven Hazel"]
9
- s.date = %q{2011-04-11}
8
+ s.authors = ["Eric Allen", "Sean Grove", "Steven Hazel", "Santiago Suarez Ordoñez"]
9
+ s.date = %q{2011-07-25}
10
10
  s.default_executable = %q{sauce}
11
11
  s.description = %q{A Ruby interface to Sauce OnDemand.}
12
12
  s.email = %q{help@saucelabs.com}
@@ -29,6 +29,20 @@ class TestConfig < Test::Unit::TestCase
29
29
  assert_equal "{\"name\":\"Unnamed Ruby job\",\"access-key\":\"test_access\",\"os\":\"Linux\",\"username\":\"test_user\",\"browser-version\":\"3.\",\"browser\":\"firefox\"}", config.to_browser_string
30
30
  end
31
31
 
32
+ def test_generates_optional_parameters
33
+ # dashes need to work for backward compatibility
34
+ config = Sauce::Config.new(:username => "test_user", :access_key => "test_access",
35
+ :os => "Linux", :browser => "firefox", :browser_version => "3.",
36
+ :"user-extensions-url" => "testing")
37
+ assert_equal "{\"name\":\"Unnamed Ruby job\",\"access-key\":\"test_access\",\"user-extensions-url\":\"testing\",\"os\":\"Linux\",\"username\":\"test_user\",\"browser-version\":\"3.\",\"browser\":\"firefox\"}", config.to_browser_string
38
+
39
+ # underscores are more natural
40
+ config = Sauce::Config.new(:username => "test_user", :access_key => "test_access",
41
+ :os => "Linux", :browser => "firefox", :browser_version => "3.",
42
+ :user_extensions_url => "testing")
43
+ assert_equal "{\"name\":\"Unnamed Ruby job\",\"access-key\":\"test_access\",\"user-extensions-url\":\"testing\",\"os\":\"Linux\",\"username\":\"test_user\",\"browser-version\":\"3.\",\"browser\":\"firefox\"}", config.to_browser_string
44
+ end
45
+
32
46
  def test_convenience_accessors
33
47
  config = Sauce::Config.new
34
48
  assert_equal "ondemand.saucelabs.com", config.host
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauce
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric Allen
14
14
  - Sean Grove
15
15
  - Steven Hazel
16
+ - "Santiago Suarez Ordo\xC3\xB1ez"
16
17
  autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []
19
20
 
20
- date: 2011-04-11 00:00:00 -07:00
21
+ date: 2011-07-25 00:00:00 -03:00
21
22
  default_executable: sauce
22
23
  dependencies:
23
24
  - !ruby/object:Gem::Dependency
24
- name: rest-client
25
25
  prerelease: false
26
26
  requirement: &id001 !ruby/object:Gem::Requirement
27
27
  none: false
@@ -33,9 +33,9 @@ dependencies:
33
33
  - 0
34
34
  version: "0"
35
35
  type: :runtime
36
+ name: rest-client
36
37
  version_requirements: *id001
37
38
  - !ruby/object:Gem::Dependency
38
- name: net-ssh
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
@@ -47,9 +47,9 @@ dependencies:
47
47
  - 0
48
48
  version: "0"
49
49
  type: :runtime
50
+ name: net-ssh
50
51
  version_requirements: *id002
51
52
  - !ruby/object:Gem::Dependency
52
- name: net-ssh-gateway
53
53
  prerelease: false
54
54
  requirement: &id003 !ruby/object:Gem::Requirement
55
55
  none: false
@@ -61,9 +61,9 @@ dependencies:
61
61
  - 0
62
62
  version: "0"
63
63
  type: :runtime
64
+ name: net-ssh-gateway
64
65
  version_requirements: *id003
65
66
  - !ruby/object:Gem::Dependency
66
- name: selenium-webdriver
67
67
  prerelease: false
68
68
  requirement: &id004 !ruby/object:Gem::Requirement
69
69
  none: false
@@ -77,9 +77,9 @@ dependencies:
77
77
  - 4
78
78
  version: 0.1.4
79
79
  type: :runtime
80
+ name: selenium-webdriver
80
81
  version_requirements: *id004
81
82
  - !ruby/object:Gem::Dependency
82
- name: childprocess
83
83
  prerelease: false
84
84
  requirement: &id005 !ruby/object:Gem::Requirement
85
85
  none: false
@@ -93,9 +93,9 @@ dependencies:
93
93
  - 6
94
94
  version: 0.1.6
95
95
  type: :runtime
96
+ name: childprocess
96
97
  version_requirements: *id005
97
98
  - !ruby/object:Gem::Dependency
98
- name: json
99
99
  prerelease: false
100
100
  requirement: &id006 !ruby/object:Gem::Requirement
101
101
  none: false
@@ -109,9 +109,9 @@ dependencies:
109
109
  - 0
110
110
  version: 1.2.0
111
111
  type: :runtime
112
+ name: json
112
113
  version_requirements: *id006
113
114
  - !ruby/object:Gem::Dependency
114
- name: cmdparse
115
115
  prerelease: false
116
116
  requirement: &id007 !ruby/object:Gem::Requirement
117
117
  none: false
@@ -125,9 +125,9 @@ dependencies:
125
125
  - 2
126
126
  version: 2.0.2
127
127
  type: :runtime
128
+ name: cmdparse
128
129
  version_requirements: *id007
129
130
  - !ruby/object:Gem::Dependency
130
- name: highline
131
131
  prerelease: false
132
132
  requirement: &id008 !ruby/object:Gem::Requirement
133
133
  none: false
@@ -141,6 +141,7 @@ dependencies:
141
141
  - 0
142
142
  version: 1.5.0
143
143
  type: :runtime
144
+ name: highline
144
145
  version_requirements: *id008
145
146
  description: A Ruby interface to Sauce OnDemand.
146
147
  email: help@saucelabs.com
@@ -221,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
222
  requirements: []
222
223
 
223
224
  rubyforge_project:
224
- rubygems_version: 1.4.2
225
+ rubygems_version: 1.6.2
225
226
  signing_key:
226
227
  specification_version: 3
227
228
  summary: Ruby access to Sauce Labs' features