Skip to content

Commit 4afcf6f

Browse files
committed
Fix for "undefined local variable or method" errors
1 parent 9ea0754 commit 4afcf6f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

android_tests/lib/run.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
# Run only the view album test:
1111
# ruby run.rb ios view_album
1212

13+
def start_driver(caps)
14+
driver = Appium::Driver.new(caps)
15+
# Tests expect methods defined on the minispec object
16+
Appium.promote_appium_methods ::Minitest::Spec
17+
driver.start_driver
18+
end
19+
1320
# Sanity check
1421
a = OpenStruct.new x: 'ok'
1522
fail 'x issue' unless a.x == 'ok'
@@ -40,10 +47,7 @@
4047
end
4148

4249
fail "\nTest #{one_test} does not exist.\n" unless File.exist?(one_test)
43-
driver = Appium::Driver.new(caps)
44-
# Tests expect methods defined on the minispec object
45-
Appium.promote_appium_methods ::Minitest::Spec
46-
driver.start_driver
50+
start_driver(caps)
4751

4852
# require support (common.rb)
4953
Dir.glob(File.join dir, test_dir + '/*.rb') do |test|
@@ -61,7 +65,8 @@
6165
puts " #{File.basename(test, '.*')}"
6266
require test
6367
end
64-
Appium::Driver.new(caps).start_driver
68+
69+
start_driver(caps)
6570
end
6671

6772
trace_files.map! do |f|

0 commit comments

Comments
 (0)