summaryrefslogtreecommitdiff
path: root/spec/node_spec.rb
blob: 0e4ff2912f0da360b60f79774a0d5ae6da204b70 (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
describe Chef::Node do
  subject { Chef::Node.new }
  let(:attributes) { { rails_4: true, rbac: false } }

  before :each do
    subject.default_attrs = attributes
  end

  describe "#feature_enabled?" do
    context "when the feature is enabled on the node" do
      it 'returns true' do
        expect(subject.feature_enabled?(:rails_4)).to be_truthy
      end
    end

    context "when the feature is not enabled" do
      it 'returns false' do
        expect(subject.feature_enabled?(:rbac)).to be_falsey
      end
    end

    context "when the feature is unknown" do
      it 'returns false' do
        expect(subject.feature_enabled?(:oauth)).to be_falsey
      end
    end
  end
end