Sha256: f8c0f82d920df584a67052d0f02c0f5af002f20a38b93c32702bb139025c4476

Contents?: true

Size: 1.75 KB

Versions: 56

Compression:

Stored size: 1.75 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)

       subject.override_attributes.should have_key("deep")
       subject.override_attributes["deep"].should have_key("nested")
       subject.override_attributes["deep"]["nested"].should have_key("item")
       subject.override_attributes["deep"]["nested"]["item"].should be_true
    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)

        subject.override_attributes["deep"]["nested"]["item"].should be_true
      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)

       subject.default_attributes.should have_key("deep")
       subject.default_attributes["deep"].should have_key("nested")
       subject.default_attributes["deep"]["nested"].should have_key("item")
       subject.default_attributes["deep"]["nested"]["item"].should be_true
    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)

        subject.default_attributes["deep"]["nested"]["item"].should be_true
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
ridley-1.7.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.6.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.5.3 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.2.6 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.5.2 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.5.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.5.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.2.5 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.4.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.4.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.3.2 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.3.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.3.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.0.3 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.2.4 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.2.3 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.2.2 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.2.1 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.2.0 spec/unit/ridley/chef_objects/role_object_spec.rb
ridley-1.1.1 spec/unit/ridley/chef_objects/role_object_spec.rb