lib/calabash/location.rb in calabash-1.9.9.pre2 vs lib/calabash/location.rb in calabash-1.9.9.pre3
- old
+ new
@@ -1,29 +1,28 @@
require 'geocoder'
module Calabash
+ # @!visibility private
module Location
# Simulates gps location of the device/simulator.
# @note Seems UIAutomation is broken here on physical devices on iOS 7.1
#
# @example
# set_location({latitude: 48.8567, longitude: 2.3508})
#
# @example
# set_location(coordinates_for_place('The little mermaid, Copenhagen'))
#
- # @param {Hash} options specifies which location to simulate
- # @option options {Numeric} :latitude latitude of a gps coordinate (same
- # coordinate system as Google maps)
- # @option options {Numeric} :longitude longitude of a gps coordinate (same
- # coordinate system as Google maps)
+ # @param [Hash] location The location to simulate.
+ # @raise [ArgumentError] If location is not a hash and does not contain a
+ # latitude and longitude key.
def set_location(location)
unless location.is_a?(Hash)
raise ArgumentError, "Expected location to be a Hash, not '#{location.class}'"
end
unless location[:latitude] || location[:longitude]
- raise ArgumentError, "You must supply :latitude and :longitude"
+ raise ArgumentError, 'You must supply :latitude and :longitude'
end
Device.default.set_location(location)
end