lib/calabash/ios/defaults.rb in calabash-1.9.9.pre2 vs lib/calabash/ios/defaults.rb in calabash-1.9.9.pre3

- old
+ new

@@ -1,27 +1,42 @@ module Calabash module IOS - def self.setup_defaults! - setup_default_application! - setup_default_device! - end - - def self.setup_default_device! - if Calabash.default_application.nil? - raise 'Cannot setup default device for iOS, as no default Application has been set' + module Defaults + # Sets up the default application based on the + # environment, and the default device based on the default application + # and the environment. + # + # @see Calabash::IOS::Defaults#setup_default_application! + # @see Calabash::IOS::Defaults#setup_default_device! + # @see Calabash::Environment + def setup_defaults! + setup_default_application! + setup_default_device! end - # Setup the default device - identifier = - Device.default_identifier_for_application(Calabash.default_application) + # Sets up the default device based on the default application and the + # environment. + # + # @raise [RuntimeError] Raises an error if the default application has + # not been set. + def setup_default_device! + if Calabash.default_application.nil? + raise 'Cannot setup default device for iOS, as no default Application has been set' + end - server = Server.default + # Setup the default device + identifier = + Device.default_identifier_for_application(Calabash.default_application) - Calabash.default_device = Device.new(identifier, server) - end + server = Server.default - def self.setup_default_application! - # Setup the default application - Calabash.default_application = Application.default_from_environment + Calabash.default_device = Device.new(identifier, server) + end + + # Sets up the default application based on the environment. + def setup_default_application! + # Setup the default application + Calabash.default_application = Application.default_from_environment + end end end end