summaryrefslogtreecommitdiffstats
path: root/spec/unit/indirector/request.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-03-13 01:22:12 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-03-20 18:27:07 +1100
commitedf00dba76b65108b443af8d0636073cb3d9d975 (patch)
tree75951e613a375dca4780d46dde35b1046f64446d /spec/unit/indirector/request.rb
parenta064ed1a6035c44f123e092b2429895fb45bdbd2 (diff)
downloadpuppet-edf00dba76b65108b443af8d0636073cb3d9d975.tar.gz
puppet-edf00dba76b65108b443af8d0636073cb3d9d975.tar.xz
puppet-edf00dba76b65108b443af8d0636073cb3d9d975.zip
Adding environment support to the REST URI
Also adding it to the Indirection Request. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/indirector/request.rb')
-rwxr-xr-xspec/unit/indirector/request.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/indirector/request.rb b/spec/unit/indirector/request.rb
index 98ecf2fd3..e2edc2641 100755
--- a/spec/unit/indirector/request.rb
+++ b/spec/unit/indirector/request.rb
@@ -9,6 +9,10 @@ describe Puppet::Indirector::Request do
lambda { Puppet::Indirector::Request.new }.should raise_error(ArgumentError)
end
+ it "should always convert the indirection name to a symbol" do
+ Puppet::Indirector::Request.new("ind", :method, "mykey").indirection_name.should == :ind
+ end
+
it "should use provided value as the key if it is a string" do
Puppet::Indirector::Request.new(:ind, :method, "mykey").key.should == "mykey"
end
@@ -178,6 +182,19 @@ describe Puppet::Indirector::Request do
Puppet::Indirector::Request.new(:myind, :find, "my key").escaped_key.should == URI.escape("my key")
end
+ it "should have an environment accessor" do
+ Puppet::Indirector::Request.new(:myind, :find, "my key", :environment => "foo").should respond_to(:environment)
+ end
+
+ it "should set its environment to an environment instance when a string is specified as its environment" do
+ Puppet::Indirector::Request.new(:myind, :find, "my key", :environment => "foo").environment.should == Puppet::Node::Environment.new("foo")
+ end
+
+ it "should use any passed in environment instances as its environment" do
+ env = Puppet::Node::Environment.new("foo")
+ Puppet::Indirector::Request.new(:myind, :find, "my key", :environment => env).environment.should equal(env)
+ end
+
describe "when building a query string from its options" do
before do
@request = Puppet::Indirector::Request.new(:myind, :find, "my key")