diff options
author | danielsdeleo <dan@opscode.com> | 2013-04-18 12:15:38 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-04-18 12:15:38 -0700 |
commit | 3bc8f3a6d671f74bfe16e66938dbb2f524435ea5 (patch) | |
tree | 087a19b6440bb89388a805fa81ad9cb661331367 | |
parent | b7163d13fe84d1b4c45beaef3084f82dc07df415 (diff) | |
download | chef-3bc8f3a6d671f74bfe16e66938dbb2f524435ea5.tar.gz |
[CHEF-3432] Move LWRP override tests into main describe block
-rw-r--r-- | spec/unit/lwrp_spec.rb | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb index a158bce440..ec4774e535 100644 --- a/spec/unit/lwrp_spec.rb +++ b/spec/unit/lwrp_spec.rb @@ -18,43 +18,44 @@ require 'spec_helper' -describe "override logging" do - before :each do - $stderr.stub!(:write) - end - it "should log if attempting to load resource of same name" do - Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp", "resources", "*"))].each do |file| - Chef::Resource::LWRPBase.build_from_file("lwrp", file, nil) - end +describe "LWRP" do + before do + @original_VERBOSE = $VERBOSE + $VERBOSE = nil + end - Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp_override", "resources", "*"))].each do |file| - Chef::Log.should_receive(:info).with(/overriding/) - Chef::Resource::LWRPBase.build_from_file("lwrp", file, nil) - end + after do + $VERBOSE = @original_VERBOSE end - it "should log if attempting to load provider of same name" do - Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp", "providers", "*"))].each do |file| - Chef::Provider::LWRPBase.build_from_file("lwrp", file, nil) + describe "when overriding an existing class" do + before :each do + $stderr.stub!(:write) end - Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp_override", "providers", "*"))].each do |file| - Chef::Log.should_receive(:info).with(/overriding/) - Chef::Provider::LWRPBase.build_from_file("lwrp", file, nil) + it "should log if attempting to load resource of same name" do + Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp", "resources", "*"))].each do |file| + Chef::Resource::LWRPBase.build_from_file("lwrp", file, nil) + end + + Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp_override", "resources", "*"))].each do |file| + Chef::Log.should_receive(:info).with(/overriding/) + Chef::Resource::LWRPBase.build_from_file("lwrp", file, nil) + end end - end -end + it "should log if attempting to load provider of same name" do + Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp", "providers", "*"))].each do |file| + Chef::Provider::LWRPBase.build_from_file("lwrp", file, nil) + end -describe "LWRP" do - before do - @original_VERBOSE = $VERBOSE - $VERBOSE = nil - end + Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp_override", "providers", "*"))].each do |file| + Chef::Log.should_receive(:info).with(/overriding/) + Chef::Provider::LWRPBase.build_from_file("lwrp", file, nil) + end + end - after do - $VERBOSE = @original_VERBOSE end describe "Lightweight Chef::Resource" do |