Sha256: 9b03c97f629980d9e7ed05f04e6a9d3ac5fa6edb54659d9897efac5ae7bef2b3
Contents?: true
Size: 813 Bytes
Versions: 23
Compression:
Stored size: 813 Bytes
Contents
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper')) require 'extlib/lazy_module' describe LazyModule do describe "instantiated with a block" do it "defers block body evaluation" do lambda do LazyModule.new do raise "Will only be evaluated when mixed in" end end.should_not raise_error end end describe "included into hosting class" do before :all do KlazzyLazyModule = LazyModule.new do def self.klassy "Klazz" end def instancy "Instanzz" end end @klass = Class.new do include KlazzyLazyModule end end it "class evals block body" do @klass.klassy.should == "Klazz" @klass.new.instancy.should == "Instanzz" end end end
Version data entries
23 entries across 22 versions & 5 rubygems