Sha256: 5cd7f3a721b170cf434d2ddc9812130d0de3354cd38aa56c31a27e13a2a8d264
Contents?: true
Size: 1.23 KB
Versions: 5
Compression:
Stored size: 1.23 KB
Contents
require File.join(__FILE__.gsub(/(.*)?\/spec\/.*$/, '\1'), 'spec/spec_helper') describe Rtml::WidgetCore::WidgetProxy do before :each do @widget_proxy = Rtml::WidgetCore::WidgetProxy.new @module = Module.new @class = Class.new @class.send(:include, Rtml::Widgets) end it "should allow inclusion of entry points after a class has already included the proxy" do # make sure I didn't messs up setup -- actually, the issue was because the class name was WidgetTest, by mistake. assert_kind_of Rtml::WidgetCore::WidgetProxy, @widget_proxy assert_kind_of Module, @module assert_kind_of Class, @class # define a 'hello' method in the module, but don't include it into widget_proxy @module.class_eval "def hello; end", __FILE__, __LINE__ assert !@module.respond_to?('hello') # because that would be a class method # include widget_proxy into the class @class.send(:include, @widget_proxy) assert !@class.methods.include?('hello') assert !@class.respond_to?('hello') # imbue (include) the 'hello' method into the widget proxy, and verify it's been added to the class @widget_proxy.imbue(@module) assert !@class.respond_to?('hello') assert @class.new.respond_to?('hello') end end
Version data entries
5 entries across 5 versions & 1 rubygems