Signed-off-by: Brice Figureau <[email protected]>
---
 spec/unit/network/rights.rb |   54 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 spec/unit/network/rights.rb

diff --git a/spec/unit/network/rights.rb b/spec/unit/network/rights.rb
new file mode 100644
index 0000000..5fe8e51
--- /dev/null
+++ b/spec/unit/network/rights.rb
@@ -0,0 +1,54 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+require 'puppet/network/rights'
+
+describe Puppet::Network::Rights do
+    before do
+        @right = Puppet::Network::Rights.new
+    end
+
+    [:allow, :allowed?, :deny].each do |m|
+        it "should have a #{m} method" do
+            @right.should respond_to(m)
+        end
+
+        describe "when using #{m}" do
+            it "should delegate to the correct acl" do
+                acl = stub 'acl'
+                @right.stubs(:right).returns(acl)
+
+                acl.expects(m).with("me")
+
+                @right.send(m, 'thisacl', "me")
+            end
+        end
+    end
+
+    describe "when creating new ACLs" do
+        it "should throw an error if the ACL already exists" do
+            @right.newright("name")
+
+            lambda { @right.newright("name")}.should raise_error
+        end
+
+        it "should create a new ACL with the correct name" do
+            @right.newright("name")
+
+            @right["name"].name.should == :name
+        end
+
+        it "should create an ACL of type Puppet::Network::AuthStore" do
+            @right.newright("name")
+
+            @right["name"].should be_a_kind_of(Puppet::Network::AuthStore)
+        end
+
+        it "should create an ACL with a shortname" do
+            @right.newright("name")
+
+            @right["name"].shortname.should == "n"
+        end
+    end
+end
-- 
1.6.0.2


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to