Skip to content

Commit

Permalink
[CHEF-2092] guard against resource.action not returning an array
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsdeleo authored and Nuo Yan committed Jul 14, 2011
1 parent 951b31b commit af648c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chef/lib/chef/provider/subversion.rb
Expand Up @@ -31,7 +31,7 @@ class Subversion < Chef::Provider
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
Expand Down
9 changes: 8 additions & 1 deletion chef/spec/unit/provider/subversion_spec.rb
Expand Up @@ -87,7 +87,14 @@
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
Expand Down

0 comments on commit af648c7

Please sign in to comment.