summaryrefslogtreecommitdiff
path: root/spec/unit/resource/homebrew_update_spec.rb
blob: 3bf39afe9cfd72d2371f661e88a7762f5b65cd92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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