Permalink
Browse files

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

  • Loading branch information...
1 parent 951b31b commit af648c79224a1f91055c9c7ab49554d7a696c5ce @danielsdeleo danielsdeleo committed with Nuo Yan Apr 19, 2011
Showing with 9 additions and 2 deletions.
  1. +1 −1 chef/lib/chef/provider/subversion.rb
  2. +8 −1 chef/spec/unit/provider/subversion_spec.rb
@@ -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
@@ -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

0 comments on commit af648c7

Please sign in to comment.