spank 0.0.1369197619 → 0.0.1385937112

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: 6b6d6040181dfe362c98a27fa68a05307ad1f0e2
4
- data.tar.gz: f106ec78d4f6790dd4e613d86e01e32704a907d5
3
+ metadata.gz: 0e5f65fe9fa7c155adee5d30355d7ca5c69eb632
4
+ data.tar.gz: 8d5bb20f797d908b152354e2bb3c034db027050a
5
5
  SHA512:
6
- metadata.gz: bec2b4808293eeafea2ea08bdd7f822dbaa7530883c018b7f8f0dcb912784e4a88acd6d5ccb7d43e98ebe73c6078c59ffd65abd07339435f60c24226a592b40f
7
- data.tar.gz: 9ac2674a371a5776f8751f118dc33f79edcd74bfc792fa6bc18d4741d842d8ad8b6551daece1c03d54b036fcb5474fa0101fd0786744914923972a8cbefc9168
6
+ metadata.gz: 63edc02dcbf896d4a999e3eda1652d4302e06f987984fec2085f84cd7d2a343e309b611bc053ffc1f543fb6ad851d028ad4565e618dcadb56a015627b2f0e78f
7
+ data.tar.gz: 2a1a0a780824fb18b98462617105e7cc997ab053bfd895db9f5fe3318e23fb834078fea8e522956a066dc6216c65d23e36c827182c2b48acce74db7726d65733
@@ -1 +1 @@
1
- ruby-2.0.0-p195
1
+ ruby-2.0.0-p353
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  A simple light weight inversion of control container written in ruby.
4
4
 
5
5
  [![Build Status](https://travis-ci.org/mokhan/spank.png)](https://travis-ci.org/mokhan/spank)
6
+ [![Code Climate](https://codeclimate.com/github/mokhan/spank.png)](https://codeclimate.com/github/mokhan/spank)
6
7
 
7
8
  ## Installation
8
9
 
@@ -1,3 +1,4 @@
1
+ module Spank
1
2
  class InterceptorChain
2
3
  def initialize(interceptors = [])
3
4
  @interceptors = interceptors
@@ -10,4 +11,11 @@
10
11
  def each(&block)
11
12
  @interceptors.each(&block)
12
13
  end
14
+
15
+ def intercept(invocation)
16
+ each do |interceptor|
17
+ interceptor.intercept(invocation)
18
+ end
19
+ end
13
20
  end
21
+ end
@@ -3,6 +3,7 @@ module Spank
3
3
  def self.bind_to(container)
4
4
  @@container = container
5
5
  end
6
+
6
7
  def self.resolve(symbol)
7
8
  @@container.resolve(symbol)
8
9
  end
@@ -29,9 +29,7 @@ module Spank
29
29
  Module.new do
30
30
  define_method(method.to_sym) do |*args, &block|
31
31
  invocation = create_invocation_for(method, args, block)
32
- @interceptor_chain.each do |interceptor|
33
- interceptor.intercept(invocation)
34
- end
32
+ @interceptor_chain.intercept(invocation)
35
33
  invocation.result
36
34
  end
37
35
  end
@@ -22,6 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "bundler", "~> 1.3"
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency "rspec"
25
- spec.add_development_dependency "rspec-fakes"
26
25
  spec.add_development_dependency "simplecov"
27
26
  end
@@ -1,4 +1,3 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.start
3
- require 'rspec-fakes'
4
3
  require 'spank'
@@ -27,8 +27,8 @@ module Spank
27
27
  end
28
28
 
29
29
  describe "when multiple items are registered with the same key" do
30
- let(:jeans) { fake }
31
- let(:dress_pants) { fake }
30
+ let(:jeans) { double("jeans") }
31
+ let(:dress_pants) { double("dress pants") }
32
32
 
33
33
  before :each do
34
34
  sut.register(:pants) { jeans }
@@ -60,7 +60,7 @@ module Spank
60
60
 
61
61
  context "when a component is registered as a singleton" do
62
62
  before :each do
63
- sut.register(:singleton) { fake }.as_singleton
63
+ sut.register(:singleton) { Object.new }.as_singleton
64
64
  end
65
65
 
66
66
  it "should return the same instance of that component each time it is resolved" do
@@ -88,8 +88,8 @@ module Spank
88
88
  end
89
89
 
90
90
  context "when the dependencies have been registered" do
91
- let(:mom) { fake }
92
- let(:dad) { fake }
91
+ let(:mom) { double("mom") }
92
+ let(:dad) { double("dad") }
93
93
 
94
94
  before :each do
95
95
  sut.register(:mom) { mom }
@@ -2,8 +2,8 @@ require "spec_helper"
2
2
 
3
3
  describe Spank::IOC do
4
4
  context "when bound to a container" do
5
- let(:container) { fake }
6
- let(:component) { fake }
5
+ let(:container) { double }
6
+ let(:component) { double }
7
7
 
8
8
  before :each do
9
9
  container.stub(:resolve).with(:idbconnection).and_return(component)
@@ -3,19 +3,19 @@ require "spec_helper"
3
3
  module Spank
4
4
  describe Proxy do
5
5
  let(:sut) { Proxy.new(target) }
6
- let(:target) { fake }
6
+ let(:target) { double("target", :greet => nil) }
7
7
 
8
8
  context "when invoking a method" do
9
9
  before { sut.greet('blah') }
10
10
 
11
11
  it "should send the message to the target" do
12
- target.should have_received(:greet, 'blah')
12
+ target.should have_received(:greet).with('blah')
13
13
  end
14
14
  end
15
15
 
16
16
  context "when an interceptor is registered" do
17
17
  context "when invoking a method" do
18
- let(:interceptor) { fake }
18
+ let(:interceptor) { double('interceptor', :intercept => "") }
19
19
 
20
20
  before :each do
21
21
  sut.add_interceptor(:greet, interceptor)
@@ -25,6 +25,7 @@ module Spank
25
25
  interceptor.should have_received(:intercept)
26
26
  end
27
27
  end
28
+
28
29
  context "when invoking a method with a block" do
29
30
  it "should pass the block to the target" do
30
31
  proxy = Proxy.new([])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1369197619
4
+ version: 0.0.1385937112
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-22 00:00:00.000000000 Z
11
+ date: 2013-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec-fakes
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: simplecov
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -92,7 +78,6 @@ files:
92
78
  - .ruby-version
93
79
  - .travis.yml
94
80
  - Gemfile
95
- - Gemfile.lock
96
81
  - LICENSE.txt
97
82
  - README.md
98
83
  - Rakefile
@@ -131,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
116
  version: '0'
132
117
  requirements: []
133
118
  rubyforge_project:
134
- rubygems_version: 2.0.3
119
+ rubygems_version: 2.1.11
135
120
  signing_key:
136
121
  specification_version: 4
137
122
  summary: spank!