mindi 0.5
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 +7 -0
- data/COPYING +22 -0
- data/README.md +174 -0
- data/RELEASE-NOTES +26 -0
- data/Rakefile +64 -0
- data/examples/JW-app-cont-injected.rb +36 -0
- data/examples/JW-app-cont.rb +37 -0
- data/examples/coffee.rb +77 -0
- data/examples/color-namespace.rb +36 -0
- data/examples/duck.rb +66 -0
- data/examples/dynamic.rb +24 -0
- data/examples/game.rb +127 -0
- data/examples/inject.rb +141 -0
- data/examples/rake-alike.rb +13 -0
- data/examples/simple.rb +15 -0
- data/examples/test.rb +117 -0
- data/examples/transform.rb +54 -0
- data/examples/wip/drb-example.rb +14 -0
- data/examples/wip/inj-param.rb +12 -0
- data/examples/wip/mink.rb +58 -0
- data/lib/mindi.rb +383 -0
- data/test/test-injectable-container.rb +5 -0
- data/test/test-injectable.rb +48 -0
- metadata +78 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'mindi'
|
3
|
+
|
4
|
+
class Test_Injected < Minitest::Test
|
5
|
+
# If there is no container, the normal method_missing should be used.
|
6
|
+
def test_no_cointainer
|
7
|
+
injected = Object.new
|
8
|
+
injected.extend MinDI::Injectable::Injected
|
9
|
+
|
10
|
+
def injected.method_missing(m, *args)
|
11
|
+
args[0]
|
12
|
+
end
|
13
|
+
|
14
|
+
val = "Yep, that's it"
|
15
|
+
assert_equal(val, injected.foobar(val))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
class Test_Injectable < Minitest::Test
|
21
|
+
def test_inject_into
|
22
|
+
injectable = Object.new
|
23
|
+
injectable.extend MinDI::Injectable
|
24
|
+
|
25
|
+
def injectable.foo
|
26
|
+
:foo
|
27
|
+
end
|
28
|
+
|
29
|
+
injected = Object.new
|
30
|
+
injectable.inject_into injected
|
31
|
+
|
32
|
+
assert_equal(injectable.foo, injected.foo)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_non_non_unique_container
|
36
|
+
injectable = Object.new
|
37
|
+
injectable.extend MinDI::Injectable
|
38
|
+
|
39
|
+
injectable2 = Object.new
|
40
|
+
injectable2.extend MinDI::Injectable
|
41
|
+
|
42
|
+
injected = Object.new
|
43
|
+
injectable.inject_into injected
|
44
|
+
assert_raises(MinDI::Injectable::NonUniqueContainerError) do
|
45
|
+
injectable2.inject_into injected
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mindi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.5'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joel VanderWerf
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-25 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: MinDI is minimalist in that it attempts to map concepts of DI into basic
|
14
|
+
ruby constructs, rather than into a layer of specialized constructs.
|
15
|
+
email: vjoel@users.sourceforge.net
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README.md
|
20
|
+
- COPYING
|
21
|
+
files:
|
22
|
+
- COPYING
|
23
|
+
- README.md
|
24
|
+
- RELEASE-NOTES
|
25
|
+
- Rakefile
|
26
|
+
- examples/JW-app-cont-injected.rb
|
27
|
+
- examples/JW-app-cont.rb
|
28
|
+
- examples/coffee.rb
|
29
|
+
- examples/color-namespace.rb
|
30
|
+
- examples/duck.rb
|
31
|
+
- examples/dynamic.rb
|
32
|
+
- examples/game.rb
|
33
|
+
- examples/inject.rb
|
34
|
+
- examples/rake-alike.rb
|
35
|
+
- examples/simple.rb
|
36
|
+
- examples/test.rb
|
37
|
+
- examples/transform.rb
|
38
|
+
- examples/wip/drb-example.rb
|
39
|
+
- examples/wip/inj-param.rb
|
40
|
+
- examples/wip/mink.rb
|
41
|
+
- lib/mindi.rb
|
42
|
+
- test/test-injectable-container.rb
|
43
|
+
- test/test-injectable.rb
|
44
|
+
homepage: https://github.com/vjoel/mindi
|
45
|
+
licenses:
|
46
|
+
- BSD
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options:
|
50
|
+
- "--quiet"
|
51
|
+
- "--line-numbers"
|
52
|
+
- "--inline-source"
|
53
|
+
- "--title"
|
54
|
+
- MinDI
|
55
|
+
- "--main"
|
56
|
+
- README.md
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.2.1
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Minimalist dependency injection
|
75
|
+
test_files:
|
76
|
+
- test/test-injectable.rb
|
77
|
+
- test/test-injectable-container.rb
|
78
|
+
has_rdoc:
|