Skip to content

Commit

Permalink
Merge pull request chef#1682 from opscode/lcg/merge-from-11-stable
Browse files Browse the repository at this point in the history
Lcg/merge from 11 stable
  • Loading branch information
lamont-granquist committed Jul 24, 2014
2 parents 9a4cbb8 + 09912f5 commit a2f4d9a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion chef.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.add_dependency "mixlib-log", "~> 1.3"
s.add_dependency "mixlib-authentication", "~> 1.3"
s.add_dependency "mixlib-shellout", "~> 1.4"
s.add_dependency "ohai", "= 7.2.0.rc.1"
s.add_dependency "ohai", "~> 7.2"

s.add_dependency "ffi-yajl", "~> 1.0"
s.add_dependency "net-ssh", "~> 2.6"
Expand Down
13 changes: 10 additions & 3 deletions lib/chef/resource/lwrp_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,16 @@ def #{attr_name}(arg=nil)
# Sets the default action
def self.default_action(action_name=NULL_ARG)
unless action_name.equal?(NULL_ARG)
action = action_name.to_sym
actions.push(action) unless actions.include?(action)
@default_action = action
@actions ||= []
if action_name.is_a?(Array)
action = action_name.map { |arg| arg.to_sym }
@actions = actions | action
@default_action = action
else
action = action_name.to_sym
@actions.push(action) unless @actions.include?(action)
@default_action = action
end
end

@default_action ||= from_superclass(:default_action)
Expand Down
4 changes: 2 additions & 2 deletions pedant.gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
source "https://rubygems.org"
gemspec :name => "chef"

gem 'rest-client', :github => 'opscode/rest-client'
gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => '4744d7f318b629ff60a0d22cf02296df36936397'
gem 'rest-client', :github => 'opscode/rest-client', :branch => 'lcg/1.6.7-version-lying'
gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => 'd12864964a18994b467908daa91811eee1f1bf68'

# TODO figure out how to grab this stuff from the main Gemfile
gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby"
Expand Down
13 changes: 13 additions & 0 deletions spec/unit/lwrp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,19 @@ module LwrpConstScopingConflict
end
end

describe "when #default_action is an array" do
let(:lwrp) do
Class.new(Chef::Resource::LWRPBase) do
actions :eat, :sleep
default_action [:eat, :sleep]
end
end

it "returns the array of default actions" do
expect(lwrp.default_action).to eq([:eat, :sleep])
end
end

describe "when inheriting from LWRPBase" do
let(:parent) do
Class.new(Chef::Resource::LWRPBase) do
Expand Down

0 comments on commit a2f4d9a

Please sign in to comment.