Commit af648c79 authored by Daniel DeLeo's avatar Daniel DeLeo Committed by Nuo Yan
Browse files

[CHEF-2092] guard against resource.action not returning an array

parent 951b31b2
......@@ -31,7 +31,7 @@ class Chef
def load_current_resource
@current_resource = Chef::Resource::Subversion.new(@new_resource.name)
unless [:export, :force_export].include?(@new_resource.action.first)
unless [:export, :force_export].include?(Array(@new_resource.action).first)
if current_revision = find_current_revision
@current_resource.revision current_revision
end
......
......@@ -87,7 +87,14 @@ describe Chef::Provider::Subversion do
and_return(@exitstatus)
@provider.find_current_revision.should be_nil
end
it "finds the current revision when loading the current resource state" do
# note: the test is kinda janky, but it provides regression coverage for CHEF-2092
@resource.instance_variable_set(:@action, :sync)
@provider.should_receive(:find_current_revision).and_return("12345")
@provider.load_current_resource
@provider.current_resource.revision.should == "12345"
end
end
it "creates the current_resource object and sets its revision to the current deployment's revision as long as we're not exporting" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment