Sha256: 2a129d6d19e1c00b544ab725cce62317d9879bbe235a47981eae11141c2e7bfb

Contents?: true

Size: 1.8 KB

Versions: 14

Compression:

Stored size: 1.8 KB

Contents

require 'spec_helper'

describe Ridley::RoleObject do
  subject { described_class.new(double('registry')) }

  describe "#set_override_attribute" do
    it "sets an override node attribute at the nested path" do
       subject.set_override_attribute('deep.nested.item', true)

       expect(subject.override_attributes).to have_key("deep")
       expect(subject.override_attributes["deep"]).to have_key("nested")
       expect(subject.override_attributes["deep"]["nested"]).to have_key("item")
       expect(subject.override_attributes["deep"]["nested"]["item"]).to be_truthy
    end

    context "when the override attribute is already set" do
      it "test" do
        subject.override_attributes = {
          deep: {
            nested: {
              item: false
            }
          }
        }
        subject.set_override_attribute('deep.nested.item', true)

        expect(subject.override_attributes["deep"]["nested"]["item"]).to be_truthy
      end
    end
  end

  describe "#set_default_attribute" do
    it "sets an override node attribute at the nested path" do
       subject.set_default_attribute('deep.nested.item', true)

       expect(subject.default_attributes).to have_key("deep")
       expect(subject.default_attributes["deep"]).to have_key("nested")
       expect(subject.default_attributes["deep"]["nested"]).to have_key("item")
       expect(subject.default_attributes["deep"]["nested"]["item"]).to be_truthy
    end

    context "when the override attribute is already set" do
      it "test" do
        subject.default_attributes = {
          deep: {
            nested: {
              item: false
            }
          }
        }
        subject.set_default_attribute('deep.nested.item', true)

        expect(subject.default_attributes["deep"]["nested"]["item"]).to be_truthy
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ridley-5.1.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-5.1.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-5.0.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.6.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.6.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.5.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.5.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.4.3 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.4.2 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.4.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.4.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.3.2 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.3.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-4.3.0 spec/unit/ridley/chef_objects/role_object_spec.rb