Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added security group stub class

  • Loading branch information...
commit 38663c47e4f45de2a5d98890158783847c6b2aeb 1 parent 985d9c5
@weavejester authored
View
13 lib/password-inquisition/base.rb
@@ -1,5 +1,18 @@
+require 'password-inquisition/security_group'
+
module Inquisition
class Base
+ def initialize
+ @security_groups = Hash.new do |hash, label|
+ hash[label] = SecurityGroup.new(label)
+ end
+ end
+
+ def security(label, &block)
+ group = @security_groups[label]
+ group.instance_eval(&block) if block_given?
+ end
+
def test(password)
nil
end
View
4 lib/password-inquisition/security_group.rb
@@ -0,0 +1,4 @@
+module Inquisition
+ class SecurityGroup
+ end
+end
View
14 spec/password-inquisition/base_spec.rb
@@ -2,4 +2,18 @@
require 'password-inquisition/base'
describe Inquisition::Base do
+ describe ".new" do
+ it "accepts a block to be instance_eval'd" do
+ Inquisition::Base.new do
+ self.class.should == Inquisition::Base
+ end
+ end
+ end
+
+ describe "#security" do
+ it "creates a security group" do
+ Inquisition::SecurityGroup.should_receive(:new).with(:fair)
+ subject.security(:fair) {}
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.