spec/unit/indirector/request_spec.rb in puppet-2.7.19 vs spec/unit/indirector/request_spec.rb in puppet-2.7.20.rc1

- old
+ new

@@ -309,6 +309,28 @@ it "should fail if options other than booleans or strings are provided" do @request.stubs(:options).returns(:one => {:one => :two}) lambda { @request.query_string }.should raise_error(ArgumentError) end end + + describe "#remote?" do + def request(options = {}) + Puppet::Indirector::Request.new('node', 'find', 'localhost', options) + end + + it "should not be unless node or ip is set" do + request.should_not be_remote + end + + it "should be remote if node is set" do + request(:node => 'example.com').should be_remote + end + + it "should be remote if ip is set" do + request(:ip => '127.0.0.1').should be_remote + end + + it "should be remote if node and ip are set" do + request(:node => 'example.com', :ip => '127.0.0.1').should be_remote + end + end end