summaryrefslogtreecommitdiff
path: root/spec/unit/util
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-02-10 17:16:00 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-02-10 17:16:00 -0800
commit452453f2844ea5ed5217f0c8d90b92cf61e400d0 (patch)
treee2afc458d6578001ecb2ef7ed116411577297d41 /spec/unit/util
parentadc4a07922bb39ea425b8cec410249006886da85 (diff)
downloadchef-452453f2844ea5ed5217f0c8d90b92cf61e400d0.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.
Diffstat (limited to 'spec/unit/util')
-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