diff options
| author | mo khan <mo@mokhan.ca> | 2013-12-27 10:51:56 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-12-27 10:51:56 -0700 |
| commit | da6c34c6e4fe4b4d2ed5fd5cb76fac3b369a5020 (patch) | |
| tree | a462c0f9727e8939eff602fe6c206a626db5d3e3 | |
| parent | ecb8071d40481a0de66a4c930e049afa3e525a34 (diff) | |
remove unused lazy loader
| -rw-r--r-- | Gemfile.lock | 2 | ||||
| -rw-r--r-- | lib/infrastructure/lazy.rb | 18 | ||||
| -rw-r--r-- | spec/specs/infrastructure/lazy_spec.rb | 34 |
3 files changed, 1 insertions, 53 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 09b3961..79fde05 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,7 +28,7 @@ GEM multi_json (1.8.2) multi_xml (0.5.5) multipart-post (1.2.0) - nasty (0.0.1388165564) + nasty (0.0.1388166636) oauth2 (0.9.2) faraday (~> 0.8) httpauth (~> 0.2) diff --git a/lib/infrastructure/lazy.rb b/lib/infrastructure/lazy.rb deleted file mode 100644 index 4aa18e1..0000000 --- a/lib/infrastructure/lazy.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spank' - -module Booty - class Lazy - def initialize(resolver = ->() { }) - @resolver = resolver - end - - def method_missing(name, *args, &block) - @target ||= @resolver.call - @target.send(name, args, &block) - end - - def self.load(key, resolver = ->() { Spank::IOC.resolve(key) }) - Lazy.new(resolver) - end - end -end diff --git a/spec/specs/infrastructure/lazy_spec.rb b/spec/specs/infrastructure/lazy_spec.rb deleted file mode 100644 index 8579987..0000000 --- a/spec/specs/infrastructure/lazy_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require "spec_helper" - -module Booty - describe Lazy do - context "when lazy loading an item from a container" do - context "when invoking a method on the proxy" do - let(:container) { fake } - let(:blackbook) { fake } - - before :each do - blackbook.stub(:find).and_return("booty call") - container.stub(:resolve).with(:blackbook).and_return(blackbook) - ::Spank::IOC.bind_to(container) - end - - it "should invoke the target" do - Lazy.load(:blackbook).find(:booty).should == "booty call" - end - end - context "before invocation" do - let(:container) { fake } - - before :each do - ::Spank::IOC.bind_to(container) - Lazy.load(:blackbook) - end - - it "should not resolve the component from the container" do - container.should_not have_received(:resolve) - end - end - end - end -end |
