Sha256: 1086c904ac0bd0a8d1082db48d2e4eabab001afe724a0810a824edde02017211

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require "#{File.dirname __FILE__}/../vresource_spec_helper"
require "vresource/class_loader"
require "vresource/module"

describe "VResource, Module" do  
  
  before :all do
    @original_dir = "#{File.dirname(__FILE__)}/module_spec_data"
    @dir = "#{File.dirname(__FILE__)}/module_spec"
    
    FileUtils.rm_r @dir if File.exist? @dir
    FileUtils.cp_r @original_dir, @dir
    
    @provider = VResource::FileSystemProvider.new(@dir)
    VResource.add_resource_provider @provider
    VResource.hook!
  end
  
  after :all do
    VResource.unhook!
    FileUtils.rm_r @dir if File.exist? @dir
    [:NS1, :NS2].each{|c| Object.send :remove_const, c if Object.const_defined? c}
  end

  it "resources" do
    ::NS1::B.clear_cache_method
    ::NS1::B2.clear_cache_method
    
    ::NS1::B["data"].should == "A.data"
    ::NS1::B2["data"].should == "NS1.data"
  end
  
  it "resources, should aslo inherit resources from included modules" do
    ::NS2::B.clear_cache_method    
    
    ::NS2::B["data"].should == "M.data"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-ext-0.4.1 spec/vresource/module_spec.rb
ruby-ext-0.4.0 spec/vresource/module_spec.rb