Sha256: ebeb75e0bfb7230df78e53964d678fbf374a334607e507231eceab68841751f1

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

module Calabash
  module IOS
    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

      # 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

        # Setup the default device
        identifier =
            Device.default_identifier_for_application(Calabash.default_application)

        server = Server.default

        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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
calabash-2.0.0.pre2 lib/calabash/ios/defaults.rb
calabash-2.0.0.pre1 lib/calabash/ios/defaults.rb
calabash-1.9.9.pre3 lib/calabash/ios/defaults.rb