smart_ioc 0.1.28 → 0.1.29
Sign up to get free protection for your applications and to get access to all the features.
- 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/factory_method_spec.rb +22 -4
- 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: 2c643b23f10b8d4ab31f241f8705fac4cb4abb7d
|
4
|
+
data.tar.gz: d77b6c7528997f199c2dbdc144a95ca76c59e6a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b118126120252e9dc398c40063f8dfbea966fc70b450318677366a8d4111456d96f18bfd452fa39ded0df02cfdc90863dc3658b6f6725f3d69d7ccbd7d2fc4e
|
7
|
+
data.tar.gz: b9be1f2e720ca0cb179b1ab64aeeeab706774def06716abc025f20febc6b808b15f56d678f250061ef267a804aa01ecc1e51f94abd5a03eb8d425ef977e1d19c
|
data/Gemfile.lock
CHANGED
data/lib/smart_ioc/version.rb
CHANGED
@@ -62,8 +62,16 @@ describe 'Factory Method' do
|
|
62
62
|
|
63
63
|
inject :singleton_bean
|
64
64
|
|
65
|
+
class Config
|
66
|
+
attr_reader :singleton_bean
|
67
|
+
|
68
|
+
def initialize(singleton_bean)
|
69
|
+
@singleton_bean = singleton_bean
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
65
73
|
def build
|
66
|
-
|
74
|
+
Config.new(singleton_bean)
|
67
75
|
end
|
68
76
|
end
|
69
77
|
|
@@ -74,18 +82,28 @@ describe 'Factory Method' do
|
|
74
82
|
|
75
83
|
inject :factory_config
|
76
84
|
|
85
|
+
class Logger
|
86
|
+
attr_reader :factory_config
|
87
|
+
|
88
|
+
def initialize(factory_config)
|
89
|
+
@factory_config = factory_config
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
77
93
|
def build
|
78
|
-
|
94
|
+
Logger.new(factory_config)
|
79
95
|
end
|
80
96
|
end
|
81
97
|
end
|
82
98
|
|
83
99
|
it 'creates factory_logger bean' do
|
84
|
-
expect(SmartIoC.get_bean(:factory_logger, package: :cross_refference)).to be_a(
|
100
|
+
expect(SmartIoC.get_bean(:factory_logger, package: :cross_refference)).to be_a(FactoryLogger::Logger)
|
85
101
|
end
|
86
102
|
|
87
103
|
it 'creates factory_config bean' do
|
88
|
-
|
104
|
+
config = SmartIoC.get_bean(:factory_config, package: :cross_refference)
|
105
|
+
expect(config).to be_a(FactoryConfig::Config)
|
106
|
+
expect(config.singleton_bean).to be_a(SingletonBean)
|
89
107
|
end
|
90
108
|
end
|
91
109
|
end
|