mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-24 04:46:05 +08:00
[test] Add coverage for conformsToProtocol on subclass of pure objc class.
This commit is contained in:
@@ -9,6 +9,11 @@ class TestConformsToProtocolObject2
|
||||
def optionalMethod3; 42; end
|
||||
end
|
||||
|
||||
class TestObjCSubclassConformsToProtocolObject < UIViewController
|
||||
def tableView(tableView, cellForRowAtIndexPath:indexPath); end
|
||||
def tableView(tableView, numberOfRowsInSection:section); end
|
||||
end
|
||||
|
||||
describe "conformsToProtocol:" do
|
||||
it "works on Ruby objects implementing required methods" do
|
||||
TestMethod.testConformsToProtocol(TestConformsToProtocolObject1.new).should == true
|
||||
@@ -17,4 +22,9 @@ describe "conformsToProtocol:" do
|
||||
it "works on Ruby objects implementing all methods" do
|
||||
TestMethod.testConformsToProtocol(TestConformsToProtocolObject2.new).should == true
|
||||
end
|
||||
|
||||
it "works on Ruby subclasses of pure Objective-C classes" do
|
||||
TestObjCSubclassConformsToProtocolObject.conformsToProtocol(NSProtocolFromString('UITableViewDataSource')).should == true
|
||||
TestObjCSubclassConformsToProtocolObject.new.conformsToProtocol(NSProtocolFromString('UITableViewDataSource')).should == true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user