From 451d536d4b388293bf0619d756b70f7ec0dbf051 Mon Sep 17 00:00:00 2001 From: Felix Clack Date: Wed, 13 Jan 2016 09:32:08 +1000 Subject: [PATCH] Fix failures in iOS 9 There appear to be some changes in the recent Rubymotion updates (I haven't been able to find where) that means some specs were failing when run with iOS 9 as the target. This change introduces a fix specifically to the `Constants.get` method as used by `UIActivityViewController`. The error was, passing activities to exclude from the activity view caused an error where an Array was expected but the splat wasn't creating one. The other issue this fixes is to delegate the `tag` property on a `UINavigationViewItem` to it's child `UIBarButtonItem` in the test implementation (a `UINavigationViewItem` doesn't have a `tag` property). --- Gemfile.lock | 4 ++-- motion/util/constants.rb | 1 + spec/motion/ui/ui_bar_button_item_spec.rb | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e2c39a25..ec2c448a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - bubble-wrap (1.9.4) + bubble-wrap (1.9.5) GEM remote: https://rubygems.org/ @@ -27,4 +27,4 @@ DEPENDENCIES webstub (~> 1.1) BUNDLED WITH - 1.10.4 + 1.10.6 diff --git a/motion/util/constants.rb b/motion/util/constants.rb index cfe697c0..3612be8e 100644 --- a/motion/util/constants.rb +++ b/motion/util/constants.rb @@ -24,6 +24,7 @@ def register(*ui_constants) # get("UIImagePickerControllerSourceType", ["photo_library", "camera", "saved_photos_album"]) => 3 # get("UIActivityType", [:air_drop, :print]) => ["com.apple.UIKit.activity.AirDrop", "com.apple.UIKit.activity.Print"] def get(base, *values) + values = Array(values) value = values.size == 1 ? values.first : values.flatten case value when Numeric diff --git a/spec/motion/ui/ui_bar_button_item_spec.rb b/spec/motion/ui/ui_bar_button_item_spec.rb index d7809c7f..cbe58d83 100644 --- a/spec/motion/ui/ui_bar_button_item_spec.rb +++ b/spec/motion/ui/ui_bar_button_item_spec.rb @@ -23,6 +23,14 @@ def dealloc App.notification_center.post('NavigationItemContainingBarButtonItem dealloc', nil, {'tag'=>tag}) super end + + def tag + leftBarButtonItem.tag + end + + def tag=(value) + leftBarButtonItem.tag = value + end end describe ".styled" do