diff options
author | Thom May <thom@may.lt> | 2015-05-13 16:18:00 +0100 |
---|---|---|
committer | Thom May <thom@may.lt> | 2015-05-13 16:18:00 +0100 |
commit | 8370069243b751ca7db5adc798212e5d795f0a33 (patch) | |
tree | 51c0369239046c0628ae515b242811d5d29ce8fa /spec | |
parent | c896044e0bd27f0ca0dace8ab2bbbb5626d44063 (diff) | |
parent | 38b381e46236e020348b9b38d7310cec65b80545 (diff) | |
download | chef-8370069243b751ca7db5adc798212e5d795f0a33.tar.gz |
Merge pull request #3357 from chef/jdm/3055
Escape string inside regex
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb index a42d234601..5594d6e18a 100644 --- a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb @@ -126,6 +126,13 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do expect(@inspector.recipe_snippet).to match(/^# In C:\/Users\/btm/) end + it "parses a Windows path" do + source_line = "C:\\Windows\\Temp\\packer\\cookbooks\\fake_file.rb:2: undefined local variable or method `non_existent' for main:Object (NameError)" + @resource.source_line = source_line + @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) + expect(@inspector.recipe_snippet).to match(/^# In C:\\Windows\\Temp\\packer\\/) + end + it "parses a unix path" do source_line = "/home/btm/src/chef/chef/spec/unit/fake_file.rb:2: undefined local variable or method `non_existent' for main:Object (NameError)" @resource.source_line = source_line |