summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2007-10-04 13:07:15 -0500
committerRick Bradley <rick@rickbradley.com>2007-10-04 13:07:15 -0500
commit187d91010687199457b892ca765fc1a76471c04f (patch)
tree337d7f6b55f869ef3293aa6679f2e78d529b6ae8
parentfd841b33a2920f26d472f4f38a559d8f2aa48a0c (diff)
downloadpuppet-187d91010687199457b892ca765fc1a76471c04f.tar.gz
puppet-187d91010687199457b892ca765fc1a76471c04f.tar.xz
puppet-187d91010687199457b892ca765fc1a76471c04f.zip
Spec'd a reset() method for clearing out known routes. Uses the unregister method so that any hooks there will be run. Probably a violation of YAGNI, but I'm willing to suffer it :-)
-rw-r--r--spec/unit/network/rest_server.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/network/rest_server.rb b/spec/unit/network/rest_server.rb
index d18086fff..986f95239 100644
--- a/spec/unit/network/rest_server.rb
+++ b/spec/unit/network/rest_server.rb
@@ -50,6 +50,22 @@ describe Puppet::Network::RESTServer, "in general" do
Puppet::Network::RESTServer.unregister(:foo)
Proc.new { Puppet::Network::RESTServer.unregister(:foo) }.should raise_error(ArgumentError)
end
+
+ it "should allow clearing out the list of all indirection accessible to clients" do
+ Puppet::Network::RESTServer.register(:foo, :bar)
+ Puppet::Network::RESTServer.reset
+ [ :foo, :bar, :baz].each do |indirection|
+ Proc.new { Puppet::Network::RESTServer.unregister(indirection) }.should raise_error(ArgumentError)
+ end
+ end
+
+ it "should use the normal means of turning off indirections accessible to clients when clearing all indirections" do
+ Puppet::Network::RESTServer.register(:foo, :bar, :baz)
+ Puppet::Network::RESTServer.expects(:unregister).with do |args|
+ args.include?(:foo) && args.include?(:bar) && args.include?(:baz)
+ end
+ Puppet::Network::RESTServer.reset
+ end
end
describe Puppet::Network::RESTServer, "when listening is not turned on" do