Skip to content

Commit 017788c

Browse files
committed
Various minor fixes
1 parent 33bf298 commit 017788c

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

rb/lib/selenium/webdriver/safari.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ def path=(path)
1414
def path
1515
@path ||= (
1616
path = case Platform.os
17-
when :windows
18-
Platform.find_in_program_files("Safari\\Safari.exe")
19-
when :macosx
20-
"/Applications/Safari.app/Contents/MacOS/Safari"
21-
else
22-
Platform.find_binary("Safari")
23-
end
17+
when :windows
18+
Platform.find_in_program_files("Safari\\Safari.exe")
19+
when :macosx
20+
"/Applications/Safari.app/Contents/MacOS/Safari"
21+
else
22+
Platform.find_binary("Safari")
23+
end
2424

2525
unless File.file?(path) && File.executable?(path)
2626
raise Error::WebDriverError, "unable to find the Safari executable, please set Selenium::WebDriver::Safari.path= or add it to your PATH."

rb/lib/selenium/webdriver/safari/extension.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def install
4747
return if @installed
4848

4949
if install_directory.exist?
50+
backup_directory.rmtree if backup_directory.exist?
5051
FileUtils.mv install_directory.to_s, backup_directory.to_s
5152
end
5253

rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def reset_driver!
3333
end
3434

3535
def quit_driver
36-
@driver_instance.quit if @driver_instance
36+
if @driver_instance
37+
@driver_instance.quit
38+
@driver_instance = nil
39+
end
3740
end
3841

3942
def new_driver_instance
@@ -43,7 +46,7 @@ def new_driver_instance
4346

4447
def app_server
4548
@app_server ||= (
46-
path = File.join(root_folder, "common/src/web")
49+
path = File.join(root, "common/src/web")
4750
s = RackServer.new(path)
4851
s.start
4952

@@ -63,7 +66,7 @@ def remote_server
6366
end
6467

6568
def remote_server_jar
66-
@remote_server_jar ||= File.join(root_folder, "build/java/server/test/org/openqa/selenium/server-with-tests-standalone.jar")
69+
@remote_server_jar ||= File.join(root, "build/java/server/test/org/openqa/selenium/server-with-tests-standalone.jar")
6770
end
6871

6972
def quit
@@ -93,12 +96,12 @@ def url_for(filename)
9396
url
9497
end
9598

96-
private
97-
98-
def root_folder
99-
@root_folder ||= File.expand_path("../../../../../../../", __FILE__)
99+
def root
100+
@root ||= File.expand_path("../../../../../../../", __FILE__)
100101
end
101102

103+
private
104+
102105
def create_driver
103106
instance = case driver
104107
when :remote

rb/spec/unit/selenium/webdriver/remote/bridge_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
module Selenium
44
module WebDriver
55
module Remote
6-
6+
77
describe Bridge do
88
it "raises ArgumentError if passed invalid options" do
99
lambda { Bridge.new(:foo => 'bar') }.should raise_error(ArgumentError)
1010
end
1111

1212
it "raises WebDriverError if uploading non-files" do
13-
request_body = {:sessionId => '11123', :value => {}}.to_json
13+
request_body = WebDriver.json_dump(:sessionId => '11123', :value => {})
1414
headers = {'Content-Type' => 'application/json'}
1515
stub_request(:post, "http://127.0.0.1:4444/wd/hub/session").to_return(
1616
:status => 200, :body => request_body, :headers => headers)

0 commit comments

Comments
 (0)