diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-02 15:36:30 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-02 15:36:30 -0700 |
| commit | d4df6cc2274e119fb2a67bca0912667b0fef7866 (patch) | |
| tree | 8c5bd026ecf070fa404623a4b658de296342a5ad /spec/unit/interface | |
| parent | 8b28417f696bd7d34ea4212a89913b5e796993c7 (diff) | |
| parent | 1b42725b5caab6f8e457e11fec2488fbe94e8e43 (diff) | |
Merge branch 'bug/2.7.x/7314-backtrace-when-face-has-syntax-error' into 2.7.x
Diffstat (limited to 'spec/unit/interface')
| -rwxr-xr-x | spec/unit/interface/face_collection_spec.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/unit/interface/face_collection_spec.rb b/spec/unit/interface/face_collection_spec.rb index 890e06a9e..4ad8787c5 100755 --- a/spec/unit/interface/face_collection_spec.rb +++ b/spec/unit/interface/face_collection_spec.rb @@ -16,12 +16,13 @@ describe Puppet::Interface::FaceCollection do @original_faces = subject.instance_variable_get("@faces").dup @original_required = $".dup $".delete_if do |path| path =~ %r{/face/.*\.rb$} end - subject.instance_variable_get("@faces").clear + subject.instance_variable_get(:@faces).clear + subject.instance_variable_set(:@loaded, false) end after :each do - subject.instance_variable_set("@faces", @original_faces) - $".clear ; @original_required.each do |item| $" << item end + subject.instance_variable_set(:@faces, @original_faces) + @original_required.each {|f| $".push f unless $".include? f } end describe "::prefix_match?" do @@ -159,4 +160,21 @@ describe Puppet::Interface::FaceCollection do end end end + + context "faulty faces" do + before :each do + $:.unshift "#{PuppetSpec::FIXTURE_DIR}/faulty_face" + end + + after :each do + $:.delete_if {|x| x == "#{PuppetSpec::FIXTURE_DIR}/faulty_face"} + end + + it "should not die if a face has a syntax error" do + subject.faces.should be_include :help + subject.faces.should_not be_include :syntax + @logs.should_not be_empty + @logs.first.message.should =~ /syntax error/ + end + end end |
