lib/calabash/life_cycle.rb in calabash-2.0.0.pre10 vs lib/calabash/life_cycle.rb in calabash-2.0.0.pre11
- old
+ new
@@ -36,17 +36,17 @@
unless path_or_application
raise 'No application given, and Calabash.default_application is not set'
end
- Device.default.start_app(path_or_application, options.dup)
+ Calabash::Internal.with_default_device {|device| device.start_app(path_or_application, options.dup)}
end
# Stop the app running on
# {Calabash::Defaults#default_server Calabash.default_server}
def stop_app
- Device.default.stop_app
+ Calabash::Internal.with_default_device {|device| device.stop_app}
end
# Installs the given application. If the application is already installed,
# the application will be uninstalled, and installed afterwards. If no
# application is given, it will install
@@ -65,11 +65,11 @@
unless path_or_application
raise 'No application given, and Calabash.default_application is not set'
end
- Device.default.install_app(path_or_application)
+ Calabash::Internal.with_default_device {|device| device.install_app(path_or_application)}
end
# Installs the given application *if it is not already installed*. If no
# application is given, it will ensure `Calabash.default_application` is installed.
# If the application has changed, it will be installed using the same
@@ -88,11 +88,11 @@
unless path_or_application
raise 'No application given, and Calabash.default_application is not set'
end
- Device.default.ensure_app_installed(path_or_application)
+ Calabash::Internal.with_default_device {|device| device.ensure_app_installed(path_or_application)}
end
# Uninstalls the given application. Does nothing if the application is
# already uninstalled. If no application is given, it will uninstall
# {Calabash::Defaults#default_application Calabash.default_application}
@@ -106,11 +106,11 @@
unless path_or_application
raise 'No application given, and Calabash.default_application is not set'
end
- Device.default.uninstall_app(path_or_application)
+ Calabash::Internal.with_default_device {|device| device.uninstall_app(path_or_application)}
end
# Clears the contents of the given application. This is roughly equivalent to
# reinstalling the application. If no application is given, it will clear
# {Calabash::Defaults#default_application Calabash.default_application}.
@@ -124,11 +124,11 @@
unless path_or_application
raise 'No application given, and Calabash.default_application is not set'
end
- Device.default.clear_app_data(path_or_application)
+ Calabash::Internal.with_default_device {|device| device.clear_app_data(path_or_application)}
end
# Sends the current app to the background and resumes it after
# `for_seconds`.
#
@@ -148,11 +148,19 @@
_send_current_app_to_background(for_seconds)
true
end
+ # Attempts to reset the changes Calabash has made to the device.
+ #
+ # This method does nothing at the moment, but will be required to reset the
+ # device changes in the future.
+ def reset_device_changes
+ true
+ end
+
# @!visibility private
- def _send_current_app_to_background(for_seconds)
- abstract_method!
+ define_method(:_send_current_app_to_background) do |for_seconds|
+ abstract_method!(:_send_current_app_to_background)
end
end
end