Sha256: 675c7b0da7b523ac90196abdf7fefa4d83d4cf46d72d3a7dd62cb8290dc113df
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
covers 'facets/module/method_space' tests Class do unit :method_space => "via a block" do c = Class.new do def x; "x"; end method_space :s do def x; "sx"; end end end o = c.new o.x.assert == 'x' o.s.x.assert == 'sx' end unit :method_space => "via module" do M = Module.new do def x; "mx"; end end c = Class.new do def x; "x"; end method_space M end o = c.new o.x.assert == 'x' o.m.x.assert == 'mx' end unit :method_space => "instance method is not defined" do c = Class.new do method_space :s do def x; "sx"; end end end o = c.new expect(NoMethodError){ c.x } end instance "using #include_as" do m = Module.new do def x; "x"; end def y; @y; end end c = Class.new do include_as :m => m def initialize @y = "y" end end end unit :include_as => "provides method space" do |c| o = c.new o.m.x.assert == "x" end unit :include_as => "has access to instance scope" do |c| o = c.new o.m.y.assert == "y" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-2.9.0.pre.1 | test/tour/module/test_method_space.rb |