[test] Add coverage for conformsToProtocol on subclass of pure objc class.

This commit is contained in:
Eloy Durán
2013-11-22 18:08:51 +01:00
parent 6ec081da1c
commit 8ac9cfb2b6

View File

@@ -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