diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-02-10 17:16:00 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-02-10 17:16:00 -0800 |
commit | 452453f2844ea5ed5217f0c8d90b92cf61e400d0 (patch) | |
tree | e2afc458d6578001ecb2ef7ed116411577297d41 /spec | |
parent | adc4a07922bb39ea425b8cec410249006886da85 (diff) | |
download | chef-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')
-rw-r--r-- | spec/unit/util/file_edit_spec.rb | 7 |
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 |