[macruby-changes] [3948] MacRuby/trunk/spec/macruby/core/kvc_spec.rb

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 20 19:29:47 PDT 2010


Revision: 3948
          http://trac.macosforge.org/projects/ruby/changeset/3948
Author:   lsansonetti at apple.com
Date:     2010-04-20 19:29:46 -0700 (Tue, 20 Apr 2010)
Log Message:
-----------
added a spec for subclass KVC attribute overload

Modified Paths:
--------------
    MacRuby/trunk/spec/macruby/core/kvc_spec.rb

Modified: MacRuby/trunk/spec/macruby/core/kvc_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/kvc_spec.rb	2010-04-21 02:22:39 UTC (rev 3947)
+++ MacRuby/trunk/spec/macruby/core/kvc_spec.rb	2010-04-21 02:29:46 UTC (rev 3948)
@@ -232,4 +232,18 @@
     w.setWhatever(42)
     w.whatever.should == 42
   end
-end
\ No newline at end of file
+end
+
+class SubWrapper < Wrapper
+  def whatever; 'whatever_value'; end
+end
+
+describe "A class inheriting from a class that defines a KVC attribute" do
+  it "can also re-define it" do
+    o = SubWrapper.new
+    o.valueForKey('whatever').should == 'whatever_value'
+    o.whatever = 'OMG'
+    o.valueForKey('whatever').should == 'whatever_value'
+    o.whatever.should == 'whatever_value'
+  end
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100420/b91608c5/attachment.html>


More information about the macruby-changes mailing list