Sha256: efcd76f1f35db42e3d0a2c4d218ea8ce7fcbc471f553ff02711495afd1129a7d
Contents?: true
Size: 1.46 KB
Versions: 30
Compression:
Stored size: 1.46 KB
Contents
#! /usr/bin/env ruby require 'spec_helper' describe Puppet::Parser::Resource::Param do it "can be instantiated" do Puppet::Parser::Resource::Param.new(:name => 'myparam', :value => 'foo') end it "stores the source file" do param = Puppet::Parser::Resource::Param.new(:name => 'myparam', :value => 'foo', :file => 'foo.pp') param.file.should == 'foo.pp' end it "stores the line number" do param = Puppet::Parser::Resource::Param.new(:name => 'myparam', :value => 'foo', :line => 42) param.line.should == 42 end context "parameter validation" do it "throws an error when instantiated without a name" do expect { Puppet::Parser::Resource::Param.new(:value => 'foo') }.to raise_error(Puppet::Error, /name is a required option/) end it "throws an error when instantiated without a value" do expect { Puppet::Parser::Resource::Param.new(:name => 'myparam') }.to raise_error(Puppet::Error, /value is a required option/) end it "throws an error when instantiated with a nil value" do expect { Puppet::Parser::Resource::Param.new(:name => 'myparam', :value => nil) }.to raise_error(Puppet::Error, /value is a required option/) end it "includes file/line context in errors" do expect { Puppet::Parser::Resource::Param.new(:name => 'myparam', :value => nil, :file => 'foo.pp', :line => 42) }.to raise_error(Puppet::Error, /foo.pp:42/) end end end
Version data entries
30 entries across 30 versions & 1 rubygems