summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-12-27 10:35:03 -0700
committermo khan <mo@mokhan.ca>2013-12-27 10:35:03 -0700
commitecb8071d40481a0de66a4c930e049afa3e525a34 (patch)
tree41f0d080310ab2377e55a0c38828aee27eb5d112
parent9f1246b527383ca8e4101c296fff07b24e23ec6a (diff)
remove block specification.
-rw-r--r--Gemfile.lock2
-rw-r--r--lib/infrastructure/block_specification.rb15
-rw-r--r--lib/infrastructure/mixins/specification.rb23
-rw-r--r--lib/web/route_registry.rb1
-rw-r--r--spec/specs/infrastructure/block_specification_spec.rb89
5 files changed, 1 insertions, 129 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index 3483708..09b3961 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.1388164945)
+ nasty (0.0.1388165564)
oauth2 (0.9.2)
faraday (~> 0.8)
httpauth (~> 0.2)
diff --git a/lib/infrastructure/block_specification.rb b/lib/infrastructure/block_specification.rb
deleted file mode 100644
index fcbec59..0000000
--- a/lib/infrastructure/block_specification.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'specification'
-
-module Booty
- class BlockSpecification
- include Booty::Specification
-
- def initialize(&block)
- @block = block
- end
-
- def matches?(item)
- @block.call(item)
- end
- end
-end
diff --git a/lib/infrastructure/mixins/specification.rb b/lib/infrastructure/mixins/specification.rb
deleted file mode 100644
index 38abebb..0000000
--- a/lib/infrastructure/mixins/specification.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-module Booty
- module Specification
- def or(other_predicate = nil, &block)
- matcher = create_predicate(other_predicate, &block)
- create_predicate { |item| self.matches?(item) || matcher.matches?(item) }
- end
-
- def and(other_predicate = nil, &block)
- matcher = create_predicate(other_predicate, &block)
- create_predicate { |item| self.matches?(item) && matcher.matches?(item) }
- end
-
- def not
- create_predicate { |item| !self.matches?(item) }
- end
-
- private
-
- def create_predicate(predicate = nil, &block)
- block_given? ? Booty::BlockSpecification.new(&block) : predicate
- end
- end
-end
diff --git a/lib/web/route_registry.rb b/lib/web/route_registry.rb
index f53c885..42a9c53 100644
--- a/lib/web/route_registry.rb
+++ b/lib/web/route_registry.rb
@@ -1,5 +1,4 @@
require 'routed_command'
-require 'block_specification'
module Booty
class RouteRegistry
diff --git a/spec/specs/infrastructure/block_specification_spec.rb b/spec/specs/infrastructure/block_specification_spec.rb
deleted file mode 100644
index 2dd8464..0000000
--- a/spec/specs/infrastructure/block_specification_spec.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-require 'spec_helper'
-
-module Booty
- describe BlockSpecification do
- let(:sut) { BlockSpecification.new { |item| item == true } }
- context "when an item matches" do
- it "should return true" do
- sut.matches?(true).should be_true
- end
- end
- context "when an item does not match" do
- it "should return true" do
- sut.matches?(false).should be_false
- end
- end
- describe "or" do
- context "when one item matches" do
- it "should return true" do
- sut.or(BlockSpecification.new {|x| x == false} ).matches?(false).should be_true
- end
- it "should return true" do
- sut.or {|x| x == false} .matches?(false).should be_true
- end
- end
- context "when the other item matches" do
- it "should return true" do
- sut.or(BlockSpecification.new {|x| x == false} ).matches?(true).should be_true
- end
- it "should return true" do
- sut.or {|x| x == false} .matches?(true).should be_true
- end
- end
- context "when neither item matches" do
- it "should return false" do
- sut.or(BlockSpecification.new {|x| x == true}).matches?(false).should be_false
- end
- it "should return false" do
- sut.or {|x| x == true}.matches?(false).should be_false
- end
- end
- end
- describe "and" do
- context "when one item matches" do
- it "should return false" do
- sut.and(BlockSpecification.new {|x| x == false} ).matches?(false).should be_false
- end
- it "should return false" do
- sut.and {|x| x == false} .matches?(false).should be_false
- end
- end
- context "when the other item matches" do
- it "should return false" do
- sut.and(BlockSpecification.new {|x| x == false} ).matches?(true).should be_false
- end
- it "should return false" do
- sut.and {|x| x == false} .matches?(true).should be_false
- end
- end
- context "when neither item matches" do
- it "should return false" do
- sut.and(BlockSpecification.new {|x| x == true}).matches?(false).should be_false
- end
- it "should return false" do
- sut.and {|x| x == true}.matches?(false).should be_false
- end
- end
- context "when both items match" do
- it "should return true" do
- sut.and(BlockSpecification.new {|x| x == true}).matches?(true).should be_true
- end
- it "should return true" do
- sut.and {|x| x == true}.matches?(true).should be_true
- end
- end
- end
- describe "not" do
- context "when an item matches" do
- it "should return false" do
- sut.not.matches?(true).should be_false
- end
- end
- context "when an item does not match" do
- it "should return true" do
- sut.not.matches?(false).should be_true
- end
- end
- end
- end
-end