diff options
author | David Workman <workmad3@gmail.com> | 2014-09-04 22:16:40 +0100 |
---|---|---|
committer | David Workman <workmad3@gmail.com> | 2014-09-04 22:16:40 +0100 |
commit | f196d2037c9dcffe5a03b12cc3f009503455c638 (patch) | |
tree | 839f94adbb127312c29a3978e9af0786c9d49879 | |
parent | be631d50f68f56b6077965d56e2986da1e262ae3 (diff) | |
download | chef-f196d2037c9dcffe5a03b12cc3f009503455c638.tar.gz |
Making sure the right data is used throughout the test
-rw-r--r-- | spec/unit/application/apply_spec.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index 9844640b47..913faee3a2 100644 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -36,10 +36,10 @@ 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 @@ -49,6 +49,7 @@ describe Chef::Application::Apply do 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) @@ -57,7 +58,7 @@ describe Chef::Application::Apply do 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 with the file doesn't exist message" do Chef::Application.should_receive(:fatal!).with(/^No file exists at/, 1) |