summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-02-10 17:16:00 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-02-11 18:21:31 -0800
commita4e7f8efc082ff0cc1e6836250cda09847c63f01 (patch)
treecc19e328e02e42afdd2ed0f7a1dbb6955b781afe
parent8e39142cc952c6f3e6af237ac059f2171f049c3d (diff)
downloadchef-a4e7f8efc082ff0cc1e6836250cda09847c63f01.tar.gz
CHEF-5018: specific test for CHEF-5018
This tests actually goes red with the bug and green when its fixed. It actually worked fine when @contants was an IO object instead of an Array because the #each method worked identially on both. However, there's a monkeypatch in the wilds that did @contents << "thing" and that broke when it became an IO object accidentally.
-rw-r--r--spec/unit/util/file_edit_spec.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/unit/util/file_edit_spec.rb b/spec/unit/util/file_edit_spec.rb
index 3d20939469..0bf212d8fa 100644
--- a/spec/unit/util/file_edit_spec.rb
+++ b/spec/unit/util/file_edit_spec.rb
@@ -95,12 +95,17 @@ new line inserted
describe "initialiize" do
it "should create a new Chef::Util::FileEdit object" do
- expect(fedit).to be_kind_of(Chef::Util::FileEdit)
+ expect(fedit).to be_instance_of(Chef::Util::FileEdit)
end
it "should throw an exception if the input file does not exist" do
expect{Chef::Util::FileEdit.new("nonexistfile")}.to raise_error(ArgumentError)
end
+
+ # CHEF-5018: people have monkey patched this and it has accidentally been broken
+ it "should read the contents into memory as an array" do
+ expect(fedit.send(:contents)).to be_instance_of(Array)
+ end
end
describe "when the file is blank" do