summaryrefslogtreecommitdiff
path: root/spec/unit/application
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-10-10 13:42:02 -0700
committerSerdar Sutay <serdar@opscode.com>2014-10-10 13:42:02 -0700
commit0b0eef02c7f5b0200ffbda60811e7bf4fa99bab0 (patch)
treeee7c015eda2307453db463d7c867cef459fc138b /spec/unit/application
parentfa6e449b9e01cb4c2c145c1dac6ff054910dc12d (diff)
parent75fa6a4bfcdb9f413779cf11c9caace4e433df0c (diff)
downloadchef-0b0eef02c7f5b0200ffbda60811e7bf4fa99bab0.tar.gz
Merge branch 'patch-1' of github.com:workmad3/chef into sersut/rebase-chef-1971sersut/rebase-chef-1971
Diffstat (limited to 'spec/unit/application')
-rw-r--r--spec/unit/application/apply_spec.rb (renamed from spec/unit/application/apply.rb)18
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/unit/application/apply.rb b/spec/unit/application/apply_spec.rb
index 62a53c2a31..e29c038340 100644
--- a/spec/unit/application/apply.rb
+++ b/spec/unit/application/apply_spec.rb
@@ -35,24 +35,32 @@ describe Chef::Application::Apply do
describe "read_recipe_file" do
before do
@recipe_file_name = "foo.rb"
- @recipe_path = File.expand_path("foo.rb")
+ @recipe_path = File.expand_path(@recipe_file_name)
@recipe_file = double("Tempfile (mock)", :read => @recipe_text)
@app.stub(:open).with(@recipe_path).and_return(@recipe_file)
- File.stub(:exist?).with("foo.rb").and_return(true)
+ File.stub(:exist?).with(@recipe_path).and_return(true)
Chef::Application.stub(:fatal!).and_return(true)
end
+
it "should read text properly" do
@app.read_recipe_file(@recipe_file_name)[0].should == @recipe_text
end
it "should return a file_handle" do
@app.read_recipe_file(@recipe_file_name)[1].should be_instance_of(RSpec::Mocks::Mock)
end
+
+ describe "when recipe is nil" do
+ it "should raise a fatal with the missing filename message" do
+ Chef::Application.should_receive(:fatal!).with("No recipe file was provided", 1)
+ @app.read_recipe_file(nil)
+ end
+ end
describe "when recipe doesn't exist" do
before do
- File.stub(:exist?).with(@recipe_file_name).and_return(false)
+ File.stub(:exist?).with(@recipe_path).and_return(false)
end
- it "should raise a fatal" do
- Chef::Application.should_receive(:fatal!)
+ it "should raise a fatal with the file doesn't exist message" do
+ Chef::Application.should_receive(:fatal!).with(/^No file exists at/, 1)
@app.read_recipe_file(@recipe_file_name)
end
end