diff options
author | Bryan McLellan <btm@loftninjas.org> | 2014-07-09 17:45:41 -0400 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2014-08-29 08:01:47 -0400 |
commit | 5d023cb90fd04dca63465e2afa2886afd15a70f6 (patch) | |
tree | aa701055461342d46f451773ddf013f35efe344f /spec/unit/application | |
parent | 0679cf742c50bc4381b98a9d1b6820c024e524da (diff) | |
download | chef-5d023cb90fd04dca63465e2afa2886afd15a70f6.tar.gz |
CHEF-5075: order matters for recipe_url
Add a test to ensure we maintain the order of fetching the tarball before loading JSON attributes
from a file that may be in that recipe tarball
Refactor slightly for the benefit of testing
Diffstat (limited to 'spec/unit/application')
-rw-r--r-- | spec/unit/application/solo_spec.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb index dfc54db4b0..787f9ff43c 100644 --- a/spec/unit/application/solo_spec.rb +++ b/spec/unit/application/solo_spec.rb @@ -49,7 +49,6 @@ describe Chef::Application::Solo do end describe "when the json_attribs configuration option is specified" do - let(:json_attribs) { {"a" => "b"} } let(:config_fetcher) { double(Chef::ConfigFetcher, :fetch_json => json_attribs) } let(:json_source) { "https://foo.com/foo.json" } @@ -66,8 +65,6 @@ describe Chef::Application::Solo do end end - - describe "when the recipe_url configuration option is specified" do before do Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks" @@ -104,6 +101,25 @@ describe Chef::Application::Solo do end end + describe "when the json_attribs and recipe_url configuration options are both specified" do + let(:json_attribs) { {"a" => "b"} } + let(:config_fetcher) { double(Chef::ConfigFetcher, :fetch_json => json_attribs) } + let(:json_source) { "https://foo.com/foo.json" } + + before do + Chef::Config[:json_attribs] = json_source + Chef::Config[:recipe_url] = "http://icanhas.cheezburger.com/lolcats" + Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks" + FileUtils.stub(:mkdir_p).and_return(true) + Chef::Mixin::Command.stub(:run_command).and_return(true) + end + + it "should fetch the recipe_url first" do + @app.should_receive(:fetch_recipe_tarball).ordered + Chef::ConfigFetcher.should_receive(:new).ordered.and_return(config_fetcher) + @app.reconfigure + end + end describe "after the application has been configured" do before do |