smart_ioc 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/smart_ioc/bean_factory.rb +1 -1
- data/lib/smart_ioc/version.rb +1 -1
- data/spec/smart_ioc/bean_factory_spec.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d087ab33f12eb4a96aeedc806223df30c87f9b07
|
4
|
+
data.tar.gz: 04818970eaf8cab13deac3780cc24a9fbcaf13f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a10d27b132fdbf112bcc29738f450a27b865acbc4e0061818dfc30a5d6594c0634fe63730c7586d52b58225ac6f1bd8ad75209143305efdb18c09989cbfd4548
|
7
|
+
data.tar.gz: 60ed44c13c5232429d1ebfd0290b6b33f9f44580c5eddcf47adad84ab6fa9314de95fb48c69490693c5d9d5846db74cab3bec874283f937fa6ab9814d2b92c21
|
data/Gemfile.lock
CHANGED
@@ -39,7 +39,7 @@ class SmartIoC::BeanFactory
|
|
39
39
|
|
40
40
|
@bean_file_loader.require_bean(bean_name)
|
41
41
|
|
42
|
-
bds = @bean_definitions_storage.
|
42
|
+
bds = @bean_definitions_storage.filter_by_with_drop_to_default_context(bean_name, package, context)
|
43
43
|
if bds.size > 1
|
44
44
|
raise ArgumentError, "Unable to create bean :#{bean_name}.\nSeveral definitions were found.\n#{bds.map(&:inspect).join("\n\n")}"
|
45
45
|
elsif bds.size == 0
|
data/lib/smart_ioc/version.rb
CHANGED
@@ -11,6 +11,11 @@ describe SmartIoC::BeanFactory do
|
|
11
11
|
bean :repo, context: :test, package: :bean_factory
|
12
12
|
end
|
13
13
|
|
14
|
+
class DAO
|
15
|
+
include SmartIoC::Iocify
|
16
|
+
bean :dao, context: :default, package: :bean_factory
|
17
|
+
end
|
18
|
+
|
14
19
|
it 'returns proper bean for test context' do
|
15
20
|
SmartIoC::Container.get_instance.set_extra_context_for_package(:bean_factory, :test)
|
16
21
|
expect(SmartIoC::Container.get_bean(:repo)).to be_a(TestRepo)
|
@@ -20,4 +25,9 @@ describe SmartIoC::BeanFactory do
|
|
20
25
|
SmartIoC::Container.get_instance.set_extra_context_for_package(:bean_factory, :default)
|
21
26
|
expect(SmartIoC::Container.get_bean(:repo)).to be_a(Repo)
|
22
27
|
end
|
28
|
+
|
29
|
+
it 'returns proper bean for test context with fallback to default context' do
|
30
|
+
SmartIoC::Container.get_instance.set_extra_context_for_package(:bean_factory, :test)
|
31
|
+
expect(SmartIoC::Container.get_bean(:dao)).to be_a(DAO)
|
32
|
+
end
|
23
33
|
end
|