Sha256: f2dfdd983c32812cab961c7d345b18e8bbf4ea2012416a0f93d4d00c1b264786
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe SmartIoC::BeanFactory do class Repo include SmartIoC::Iocify bean :repo, context: :default, package: :bean_factory end class TestRepo include SmartIoC::Iocify bean :repo, context: :test, package: :bean_factory end class DAO include SmartIoC::Iocify bean :dao, context: :default, package: :bean_factory end it 'returns proper bean for test context' do SmartIoC::Container.get_instance.set_extra_context_for_package(:bean_factory, :test) expect(SmartIoC::Container.get_bean(:repo)).to be_a(TestRepo) end it 'returns proper bean for default context' do SmartIoC::Container.get_instance.set_extra_context_for_package(:bean_factory, :default) expect(SmartIoC::Container.get_bean(:repo)).to be_a(Repo) end it 'returns proper bean for test context with fallback to default context' do SmartIoC::Container.get_instance.set_extra_context_for_package(:bean_factory, :test) expect(SmartIoC::Container.get_bean(:dao)).to be_a(DAO) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smart_ioc-0.1.17 | spec/smart_ioc/bean_factory_spec.rb |