summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-05-27 09:51:39 -0700
committerGitHub <noreply@github.com>2020-05-27 09:51:39 -0700
commita7439473ac2575b35afb5c88e90576af03bd93e0 (patch)
tree79a3a643f4827cd4d374edd332857ac461114612 /spec/unit
parentd897f3265650c096669ba6c6da2f7530dd21f134 (diff)
parentda5cfcfd4e07b9a766ef8fa8d1a26dad379b96ef (diff)
downloadchef-a7439473ac2575b35afb5c88e90576af03bd93e0.tar.gz
Merge pull request #9896 from damacus/resource/homebrew_update
Adds the homebrew_update resource
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/resource/homebrew_update_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/resource/homebrew_update_spec.rb b/spec/unit/resource/homebrew_update_spec.rb
new file mode 100644
index 0000000000..f9c2e47f5f
--- /dev/null
+++ b/spec/unit/resource/homebrew_update_spec.rb
@@ -0,0 +1,31 @@
+require "spec_helper"
+
+describe Chef::Resource::HomebrewUpdate do
+ let(:node) { Chef::Node.new }
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
+ let(:resource) { Chef::Resource::HomebrewUpdate.new("update", run_context) }
+
+ let(:stamp_dir) { Dir.mktmpdir("brew_update_periodic") }
+ let(:stamp_file) { Dir.mktmpdir("apt_update_periodic") }
+ let(:brew_update_cmd) { %w{homebrew update} }
+
+
+ it "sets the default action as :periodic" do
+ expect(resource.action).to eql([:periodic])
+ end
+
+ it "supports :periodic, :update actions" do
+ expect { resource.action :periodic }.not_to raise_error
+ expect { resource.action :update }.not_to raise_error
+ end
+
+ it "default frequency is set to be 1 da1y" do
+ expect(resource.frequency).to eql(86_400)
+ end
+
+ it "frequency accepts integers" do
+ resource.frequency(400)
+ expect(resource.frequency).to eql(400)
+ end
+end