summaryrefslogtreecommitdiff
path: root/spec/unit/util
diff options
context:
space:
mode:
authorChris Bandy <bandy.chris@gmail.com>2014-01-10 08:02:52 +0000
committerBryan McLellan <btm@getchef.com>2014-03-19 14:39:24 -0700
commit371b391f8198acaf16766d46eafffd7a2226de0c (patch)
treed864aca79adf971f9c67772662d707a29e335408 /spec/unit/util
parent06a392a0f4e8db12f83f7ee9abbd7908d63b52cc (diff)
downloadchef-371b391f8198acaf16766d46eafffd7a2226de0c.tar.gz
CHEF-4173: Test that insert_line_if_no_match works more than once
Diffstat (limited to 'spec/unit/util')
-rw-r--r--spec/unit/util/file_edit_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/util/file_edit_spec.rb b/spec/unit/util/file_edit_spec.rb
index 0e69aee7c2..e1b8e26e69 100644
--- a/spec/unit/util/file_edit_spec.rb
+++ b/spec/unit/util/file_edit_spec.rb
@@ -194,5 +194,13 @@ new line inserted
fedit.write_file
expect(edited_file_contents).to eq(starting_content)
end
+
+ it "should work more than once" do
+ @fedit.insert_line_if_no_match(/missing/, "added")
+ @fedit.insert_line_if_no_match(/missing/, "twice")
+ @fedit.write_file
+ newfile = File.new(@tempfile.path).readlines
+ newfile.last.should match(/twice/)
+ end
end
end