Sha256: 6b0581719ee6180e102c5f12378007172e6c26abf83d89a6cf93d902b61eb5e8

Contents?: true

Size: 816 Bytes

Versions: 26

Compression:

Stored size: 816 Bytes

Contents

require 'spec_helper'

describe SmartIoC::Iocify do
  it 'raises if inject method was used without bean declaration' do
    expect {
      class MyTestClass
        include SmartIoC::Iocify

        inject :some_bean
      end
    }.to raise_error(ArgumentError, "MyTestClass is not registered as bean. Add `bean :bean_name` declaration")
  end

  it 'reloads bean when file is reloaded' do
    dir_path = File.join(File.expand_path(File.dirname(__FILE__)), 'example/utils')
    SmartIoC.find_package_beans(:users, dir_path)
    logger = SmartIoC.get_bean(:logger)
    initial_object_id = logger.object_id

    # reload file
    load(File.join(dir_path, 'logger.rb'))

    logger = SmartIoC.get_bean(:logger)
    final_object_id = logger.object_id

    expect(initial_object_id).not_to eq(final_object_id)
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

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