Tiago Bastos
2013-08-03 19:11:24 -03:00
parent 976cc6dd7f
commit e911c1c2a2
2 changed files with 17 additions and 0 deletions

View File

@@ -38,6 +38,10 @@ module ProMotion
on_unload if respond_to?(:on_unload)
end
def application(application, openURL: url, sourceApplication:source_app, annotation: annotation)
on_open_url({ url: url, source_app: source_app, annotation: annotation }) if respond_to?(:on_open_url)
end
def app_delegate
self
end

View File

@@ -84,4 +84,17 @@ describe "PM::Delegate" do
@subject.called_on_unload.should == true
end
it "should handle open URL" do
url = NSURL.URLWithString("http://example.com")
sourceApplication = 'com.example'
annotation = {jamon: true}
@subject.mock!(:on_open_url) do |parameters|
parameters[:url].should == url
parameters[:source_app].should == sourceApplication
parameters[:annotation][:jamon].should.be.true
end
@subject.application(UIApplication.sharedApplication, openURL: url, sourceApplication:sourceApplication, annotation: annotation)
end
end