Sha256: 70af211c92e8da7f68039f615cc6d0d8f67ea356e3a5be39cecb228b026d467e

Contents?: true

Size: 1.02 KB

Versions: 27

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe SmartIoC::BeanFileLoader do
  before :all do
    SmartIoC.clear

    dir_path = File.join(File.expand_path(File.dirname(__FILE__)), 'example/admins')
    SmartIoC.find_package_beans(:admins, dir_path)

    dir_path = File.join(File.expand_path(File.dirname(__FILE__)), 'example/utils')
    SmartIoC.find_package_beans(:utils, dir_path)

    dir_path = File.join(File.expand_path(File.dirname(__FILE__)), 'example/users')
    SmartIoC.find_package_beans(:users, dir_path)

    @container = SmartIoC.container
  end

  it 'sets load proc' do
    $location_loaded = false

    @container.set_load_proc do |location|
      $location_loaded = true
      load(location)
    end

    @container.get_bean(:users_creator)
    expect($location_loaded).to eq(true)
  end

  it 'requires beans only once' do
    repository = @container.get_bean(:repository, package: :admins, context: :test)
    repository = @container.get_bean(:repository, package: :admins, context: :test)
    expect(repository.get(1)).to eq(nil)
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
smart_ioc-0.5.2 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.5.1 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.5.0 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.9 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.4.0 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.8 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.7 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.6 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.5 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.2 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.1 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.3.0 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.2.5 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.2.4 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.2.3 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.2.2 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.2.1 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.2.0 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.1.30 spec/smart_ioc/bean_file_loader_spec.rb
smart_ioc-0.1.29 spec/smart_ioc/bean_file_loader_spec.rb