smart_ioc 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22a096006f50dc11ad6e43dd7121b6a07cde42b4
4
- data.tar.gz: a30fd7330b05bcabcb3af0312e92e1787f8f6b3b
3
+ metadata.gz: d087ab33f12eb4a96aeedc806223df30c87f9b07
4
+ data.tar.gz: 04818970eaf8cab13deac3780cc24a9fbcaf13f8
5
5
  SHA512:
6
- metadata.gz: ab86b19a3d729377f12dc2db706e59441286f330fd179635d8f9a0237a37662c5dc5b256e5251ecaedce2b9c9d0ed620394ab3b2a29642a93155b2b33647dbd9
7
- data.tar.gz: 364ee6a73908179074a21345ab4ffbfe4211d2828720c8ffc496da74278647f38a0365ef7b948ffb8e60c846d4e7984e8e2a5e78fc1bc0c7e1fc174ceeb48ce6
6
+ metadata.gz: a10d27b132fdbf112bcc29738f450a27b865acbc4e0061818dfc30a5d6594c0634fe63730c7586d52b58225ac6f1bd8ad75209143305efdb18c09989cbfd4548
7
+ data.tar.gz: 60ed44c13c5232429d1ebfd0290b6b33f9f44580c5eddcf47adad84ab6fa9314de95fb48c69490693c5d9d5846db74cab3bec874283f937fa6ab9814d2b92c21
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_ioc (0.1.16)
4
+ smart_ioc (0.1.17)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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.filter_by(bean_name, package, context)
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
@@ -1,3 +1,3 @@
1
1
  module SmartIoC
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_ioc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov