lib/calabash-cucumber/rotation_helpers.rb in calabash-cucumber-0.9.169.pre2 vs lib/calabash-cucumber/rotation_helpers.rb in calabash-cucumber-0.9.169.pre5

- old
+ new

@@ -1,9 +1,13 @@ +require 'calabash-cucumber/utils/logging' + module Calabash module Cucumber module RotationHelpers #=> Connection, StatusBarHelpers + include Calabash::Cucumber::Logging + def rotation_candidates %w(rotate_left_home_down rotate_left_home_left rotate_left_home_right rotate_left_home_up rotate_right_home_down rotate_right_home_left rotate_right_home_right rotate_right_home_up) end @@ -16,19 +20,19 @@ # * see apple documentation for clarification about where the home button # is in left and right landscape orientations def rotate_home_button_to(dir) dir_sym = dir.to_sym if dir_sym.eql?(:top) - if ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1' - warn "converting '#{dir}' to ':up' - please adjust your code" + if full_console_logging? + calabash_warn "converting '#{dir}' to ':up' - please adjust your code" end dir_sym = :up end if dir_sym.eql?(:bottom) - if ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1' - warn "converting '#{dir}' to ':down' - please adjust your code" + if full_console_logging? + calabash_warn "converting '#{dir}' to ':down' - please adjust your code" end dir_sym = :down end directions = [:down, :up, :left, :right] @@ -44,11 +48,11 @@ end return res if res.eql? dir_sym rotation_candidates.each { |candidate| - if ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1' + if full_console_logging? puts "try to rotate to '#{dir_sym}' using '#{candidate}'" end playback(candidate) # need a longer sleep for cloud testing sleep(0.4) @@ -61,14 +65,14 @@ end return if res.eql? dir_sym } - if ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1' - warn "Could not rotate home button to '#{dir}'." - warn 'Is rotation enabled for this controller?' - warn "Will return 'down'" + if full_console_logging? + calabash_warn "Could not rotate home button to '#{dir}'." + calabash_warn 'Is rotation enabled for this controller?' + calabash_warn "Will return 'down'" end :down end def rotate(dir) @@ -97,10 +101,10 @@ rotate_cmd = 'right_home_up' end end if rotate_cmd.nil? - if ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1' + if full_console_logging? puts "Could not rotate device in direction '#{dir}' with orientation '#{current_orientation} - will do nothing" end else playback("rotate_#{rotate_cmd}") end \ No newline at end of file