Permalink
Browse files

Renamed project to interface_enforcement

  • Loading branch information...
1 parent 5e66d36 commit f831a5b66b4569e03fff306b7a581f6583cbed65 @sheldonh committed Aug 13, 2012
View
@@ -1,5 +1,5 @@
-interface\_enforcer
-===================
+interface\_enforcement
+=====================
*WARNING* This software does not represent an opinion. It is not a call to
do things a certain way. It is an exploration of the forces and concerns at
@@ -50,7 +50,7 @@ test (the test subject).
Demo
----
-The file [demo/subscriber\_spec.rb](/sheldonh/interface_enforcer/tree/master/demo/subscriber_spec.rb)
+The file [demo/subscriber\_spec.rb](/sheldonh/interface_enforcement/tree/master/demo/subscriber_spec.rb)
demonstrates the risk present in isolated testing in a loosely typed language,
using a contrived example of an obvious mistake that nobody would make. What is
being demonstrated is the mechanism of elective test interface enforcement, not
@@ -66,8 +66,8 @@ double that does not behave like the object it stands in for.
The PublisherInterface would be written by the author of the Publisher, and
would be used by the authors of both the Publisher and the subscriber. It is
-defined in terms of the TestInterface::Enforcer for readability, because the
-in situ use of TestInterface::Enforcer is more ugly.
+defined in terms of the InterfaceEnforcement::Enforcer for readability, because the
+in situ use of InterfaceEnforcement::Enforcer is more ugly.
Background
----------
View
@@ -29,7 +29,7 @@ def gets
################
require 'spec_helper'
-require 'test_interface'
+require 'interface_enforcement'
module PublisherInterface
@@ -41,7 +41,7 @@ module PublisherInterface
}
def self.wrap(subject)
- TestInterface::Interface.new(CONTRACT).proxy(subject)
+ InterfaceEnforcement::Interface.new(CONTRACT).proxy(subject)
end
end
@@ -0,0 +1,4 @@
+require 'interface_enforcement/constraint'
+require 'interface_enforcement/interface'
+require 'interface_enforcement/method_contract'
+require 'interface_enforcement/violation'
@@ -1,4 +1,4 @@
-module TestInterface
+module InterfaceEnforcement
class AccessControl
@@ -1,7 +1,7 @@
-require 'test_interface/enforcer'
-require 'test_interface/violation'
+require 'interface_enforcement/enforcer'
+require 'interface_enforcement/violation'
-module TestInterface
+module InterfaceEnforcement
class AliasedEnforcer < Enforcer
@@ -1,10 +1,10 @@
-require 'test_interface/constraint/enumeration'
-require 'test_interface/constraint/none'
-require 'test_interface/constraint/open'
-require 'test_interface/constraint/rule'
-require 'test_interface/constraint/type'
+require 'interface_enforcement/constraint/enumeration'
+require 'interface_enforcement/constraint/none'
+require 'interface_enforcement/constraint/open'
+require 'interface_enforcement/constraint/rule'
+require 'interface_enforcement/constraint/type'
-module TestInterface
+module InterfaceEnforcement
module Constraint
@@ -1,4 +1,4 @@
-module TestInterface
+module InterfaceEnforcement
module Constraint
@@ -1,4 +1,4 @@
-module TestInterface
+module InterfaceEnforcement
module Constraint
@@ -1,4 +1,4 @@
-module TestInterface
+module InterfaceEnforcement
module Constraint
@@ -1,4 +1,4 @@
-module TestInterface
+module InterfaceEnforcement
module Constraint
@@ -1,4 +1,4 @@
-module TestInterface
+module InterfaceEnforcement
module Constraint
@@ -1,7 +1,7 @@
-require 'test_interface/access_control'
-require 'test_interface/violation'
+require 'interface_enforcement/access_control'
+require 'interface_enforcement/violation'
-module TestInterface
+module InterfaceEnforcement
class Enforcer
@@ -1,7 +1,7 @@
require 'sender'
-require 'test_interface/aliased_enforcer'
+require 'interface_enforcement/aliased_enforcer'
-module TestInterface
+module InterfaceEnforcement
class Injector
@@ -1,8 +1,8 @@
-require 'test_interface/injector'
-require 'test_interface/method_contract'
-require 'test_interface/proxy'
+require 'interface_enforcement/injector'
+require 'interface_enforcement/method_contract'
+require 'interface_enforcement/proxy'
-module TestInterface
+module InterfaceEnforcement
class Interface
@@ -14,11 +14,11 @@ def initialize(contract)
end
def proxy(subject)
- TestInterface::Proxy.new(self, subject)
+ InterfaceEnforcement::Proxy.new(self, subject)
end
def inject(subject)
- TestInterface::Injector.new(self).inject(subject)
+ InterfaceEnforcement::Injector.new(self).inject(subject)
end
def method_contract(method)
@@ -1,6 +1,6 @@
-require 'test_interface/constraint'
+require 'interface_enforcement/constraint'
-module TestInterface
+module InterfaceEnforcement
class MethodContract
@@ -1,7 +1,7 @@
require 'sender'
-require 'test_interface/enforcer'
+require 'interface_enforcement/enforcer'
-module TestInterface
+module InterfaceEnforcement
class Proxy
@@ -1,4 +1,4 @@
-module TestInterface
+module InterfaceEnforcement
class Violation < RuntimeError; end
class MethodViolation < Violation; end
View
@@ -1,4 +0,0 @@
-require 'test_interface/constraint'
-require 'test_interface/interface'
-require 'test_interface/method_contract'
-require 'test_interface/violation'
View
@@ -1,6 +1,6 @@
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
-require 'test_interface'
+require 'interface_enforcement'
Dir.glob(File.join(File.dirname(__FILE__), 'support', '**', '*.rb')).each do |f|
require f
@@ -1,6 +1,6 @@
-require 'test_interface'
+require 'interface_enforcement'
-module TestInterface
+module InterfaceEnforcement
module RspecSugar
class Enforcement
@@ -18,7 +18,7 @@ def inject(subject)
end
def interface(contract)
- interface = TestInterface::Interface.new(contract)
+ interface = InterfaceEnforcement::Interface.new(contract)
Enforcement.new(interface)
end
end
@@ -1,16 +1,16 @@
require 'spec_helper'
-describe TestInterface::Constraint do
+describe InterfaceEnforcement::Constraint do
describe ".build(specification, *strategies)" do
it "raises ArgumentError for an unknown strategy" do
- expect { TestInterface::Constraint.build(String, :none, :rubbish, :any) }
+ expect { InterfaceEnforcement::Constraint.build(String, :none, :rubbish, :any) }
.to raise_error ArgumentError, /unknown.*strategy/
end
it "raises ArgumentError if all strategies gave up" do
- expect { TestInterface::Constraint.build(:rubbish, :any) }.to raise_error ArgumentError, /all strategies gave up/
+ expect { InterfaceEnforcement::Constraint.build(:rubbish, :any) }.to raise_error ArgumentError, /all strategies gave up/
end
end
@@ -30,9 +30,9 @@ def private_method
end
end
-describe TestInterface::Injector do
+describe InterfaceEnforcement::Injector do
- include TestInterface::RspecSugar
+ include InterfaceEnforcement::RspecSugar
describe "method invocation" do
@@ -43,10 +43,10 @@ def private_method
subject.get.should eq("new knowledge")
end
- it "raises a TestInterface::MethodViolation if uncontracted" do
+ it "raises a InterfaceEnforcement::MethodViolation if uncontracted" do
subject = Subject.new
interface(:set => :allowed).inject(subject)
- expect { subject.get }.to raise_error TestInterface::MethodViolation
+ expect { subject.get }.to raise_error InterfaceEnforcement::MethodViolation
end
context "nonexistent methods" do
Oops, something went wrong.

0 comments on commit f831a5b

Please sign in to comment.