Add failing tests for Ruby methods that should return retained objects.

Related to http://hipbyte.myjetbrains.com/youtrack/issue/RM-343.
This commit is contained in:
Eloy Durán
2013-12-05 16:02:16 +01:00
parent 8a94e89067
commit b9c524c391

View File

@@ -257,6 +257,26 @@ describe "Objective-C methods that return retained objects" do
end
end
describe "Ruby methods that return retained objects" do
def newObject; Object.new; end
def newbuildObject; Object.new; end
it "returns a retained object if the method name starts exactly with 'new'" do
lambda { newObject }.should.not.be.autoreleased
lambda { newbuildObject }.should.be.autoreleased
end
def copyObject; Object.new; end
def objectCopy; Object.new; end
def copyingObject; Object.new; end
it "returns a retained object if the method name contains 'copy'" do
lambda { copyObject }.should.not.be.autoreleased
lambda { objectCopy }.should.not.be.autoreleased
lambda { copyingObject }.should.be.autoreleased
end
end
class TestSetValueForKey
attr_accessor :foo
end