Skip to content

Commit b19d0e0

Browse files
Improve promote method documentation
1 parent 1b88060 commit b19d0e0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/appium_lib/driver.rb

+20
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ def self.symbolize_keys(hash)
146146
result
147147
end
148148

149+
# This method is intended to work with page objects that share
150+
# a common module. For example, Page::HomePage, Page::SignIn
151+
# those could be promoted on with Appium.promote_singleton_appium_methods Page
152+
#
153+
# If you are promoting on an individual class then you should use
154+
# Appium.promote_appium_methods instead. The singleton method is intended
155+
# only for the shared module use case.
156+
#
149157
# if modules is a module instead of an array, then the constants of
150158
# that module are promoted on.
151159
# otherwise, the array of modules will be used as the promotion target.
@@ -188,6 +196,18 @@ def self.promote_singleton_appium_methods(modules)
188196
# ```ruby
189197
# Appium.promote_appium_methods Object
190198
# ```
199+
#
200+
# It's better to promote on specific classes instead of Object
201+
#
202+
# ```ruby
203+
# # promote on rspec
204+
# Appium.promote_appium_methods RSpec::Core::ExampleGroup
205+
# ```
206+
#
207+
# ```ruby
208+
# # promote on minispec
209+
# Appium.promote_appium_methods Minitest::Spec
210+
# ```
191211
def self.promote_appium_methods(class_array)
192212
fail 'Driver is nil' if $driver.nil?
193213
# Wrap single class into an array

0 commit comments

Comments
 (0)