scorpion-ioc 0.5.10 → 0.5.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b27a8e56059ddd3bb577497d0497c0b92996c79
4
- data.tar.gz: 3bad326603cff64c05bd617296a5628f60ffdec3
3
+ metadata.gz: 52fbe5183ff0a1f9d4f205f716bbaddf513767c7
4
+ data.tar.gz: d50fa2d75a737f998ac3cffe35c89ce9e693dc32
5
5
  SHA512:
6
- metadata.gz: 72ae0574c6cb0bdb2a66a920f3fa62e9f56ec38c21bcd84fb9fbc0e5057133f1fb4fe8c2a034aaa7ae5689c61d39e945e511304696561a8994467b71a99b00ab
7
- data.tar.gz: d24503bc6e4d6ce5761f2532192943c976abd18ffccfa2cbaff948b834504f618d99909b8488458b3a6c5b917f9a74bbe0c62444181e16941e474f6a4bd79461
6
+ metadata.gz: 3b3af973484798628141cee2eb677ab5489e1482782e1b20ec9307f1f3f7c693b9a934dc42f6050241343ea07a79989612aa22495ea7ee0901fbca4826e45328
7
+ data.tar.gz: 5378df2b99f06c9002b1f165a0467bbccefbeb3f4b2afa610efe2952e9e2b9fe136d1e57a2788017a6b9eaa06e060c66ab8d9e98d5025ded6bb9145aa63d3243
@@ -66,6 +66,28 @@ module Scorpion
66
66
  before(:each){ send name }
67
67
  end
68
68
 
69
+ # Captures an instance of the given `contract` and assigns it to `name`
70
+ # and return the same instance when the scorpion resovles any instance
71
+ # of the contract.
72
+ # @param [Symbol] name of the rspec method to assign.
73
+ # @param [Module] contract to hunt for.
74
+ def capture( name, contract )
75
+ hunt( name, contract ) do
76
+ scorpion.new contract
77
+ end
78
+ end
79
+
80
+ # Captures an instance of the given `contract` and assigns it to `name`
81
+ # and return the same instance when the scorpion resovles any instance
82
+ # of the contract.
83
+ # @param [Symbol] name of the rspec method to assign.
84
+ # @param [Module] contract to hunt for.
85
+ def capture!( name, contract )
86
+ hunt!( name, contract ) do
87
+ scorpion.new contract
88
+ end
89
+ end
90
+
69
91
  end
70
92
 
71
93
  end
@@ -1,5 +1,5 @@
1
1
  module Scorpion
2
- VERSION_NUMBER = "0.5.10"
2
+ VERSION_NUMBER = "0.5.11"
3
3
  VERSION_SUFFIX = ""
4
4
  VERSION = "#{VERSION_NUMBER}#{VERSION_SUFFIX}"
5
5
  end
@@ -6,6 +6,12 @@ Scorpion::Rspec.prepare do
6
6
  hunt_for Numeric, return: 42
7
7
  end
8
8
 
9
+ module ScorpionRspecHelperSpec
10
+ class Food
11
+ include Scorpion::Object
12
+ end
13
+ end
14
+
9
15
  describe Scorpion::Rspec::Helper do
10
16
  include Scorpion::Rspec::Helper
11
17
 
@@ -29,10 +35,12 @@ describe Scorpion::Rspec::Helper do
29
35
  hunt( :number, Numeric, 5 )
30
36
  hunt( :string, String ) { "hello" }
31
37
  hunt( :double, Regexp )
38
+ capture( :food, ScorpionRspecHelperSpec::Food )
32
39
 
33
40
  specify{ expect( scorpion.fetch Numeric ).to eq 5 }
34
41
  specify{ expect( scorpion.fetch String ).to eq "hello" }
35
42
  specify{ expect( scorpion.fetch Regexp ).to be_a RSpec::Mocks::TestDouble }
43
+ specify{ expect( scorpion.fetch ScorpionRspecHelperSpec::Food ).to be_a ScorpionRspecHelperSpec::Food }
36
44
  end
37
45
 
38
46
  context "child context" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorpion-ioc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Alexander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-24 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  version: '0'
213
213
  requirements: []
214
214
  rubyforge_project:
215
- rubygems_version: 2.5.1
215
+ rubygems_version: 2.5.0
216
216
  signing_key:
217
217
  specification_version: 4
218
218
  summary: Add IoC to rails with minimal fuss and ceremony