[3948] MacRuby/trunk/spec/macruby/core/kvc_spec.rb
Revision: 3948 http://trac.macosforge.org/projects/ruby/changeset/3948 Author: lsansonetti@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
participants (1)
-
source_changes@macosforge.org