Skip to content

Commit

Permalink
Fix failures in iOS 9
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
felixclack committed Jan 12, 2016
1 parent 73d197a commit 60dec67
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: objective-c
osx_image: xcode7.2
before_install:
- (ruby --version)
- sudo chown -R travis ~/Library/RubyMotion
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bubble-wrap (1.9.4)
bubble-wrap (1.9.5)

GEM
remote: https://rubygems.org/
Expand All @@ -27,4 +27,4 @@ DEPENDENCIES
webstub (~> 1.1)

BUNDLED WITH
1.10.4
1.10.6
1 change: 1 addition & 0 deletions motion/util/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/motion/ui/ui_bar_button_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 60dec67

Please sign in to comment.