Sha256: 703918e6614d2eed7a6f7856b8cfbcd9ebbcd373397068689a2a1c2bebb02e88

Contents?: true

Size: 1.57 KB

Versions: 5

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'

include Specinfra::Helper::Cmd
set :os, :family => 'windows'

describe commands.command_class('registry_key').create do
  it { should be_an_instance_of(Specinfra::Command::Windows::Base::RegistryKey) }
end

describe windows_registry_key('PATH/TO/THE_KEY') do
  it { should exist }
end

describe windows_registry_key('PATH/TO/THE_KEY') do
  it { should have_value('Test Value') }
end

describe 'Key value types' do
  context 'default type' do
    describe windows_registry_key('PATH/TO/THE_KEY') do
      it { should have_property('TestProperty') }
    end
  end

  {
    :type_string       => 'String',
    :type_binary       => 'Binary',
    :type_dword        => 'DWord',
    :type_qword        => 'QWord',
    :type_multistring  => 'MultiString',
    :type_expandstring => 'ExpandString'
  }.each do |sym, type|
    context "type #{type}" do
      describe windows_registry_key('PATH/TO/THE_KEY') do
        it { should have_property('TestProperty', sym) }
      end
    end
  end
end

describe windows_registry_key('PATH/TO/THE_KEY') do
  it { should have_property_value('TestProperty', :type_binary, '12a07b') }
end

describe windows_registry_key('PATH/TO/THE_KEY') do
  it { should have_property_value('TestProperty', :type_dword, 'fffffd6c') }
end

describe windows_registry_key('PATH/TO/THE_KEY') do
  it { should have_property_value('TestProperty', :type_qword, '1e240') }
end

describe windows_registry_key('PATH/TO/THE_KEY') do
  it {
    value = <<-EOF
test line1
test line2
test line3
EOF
    should have_property_value('TestProperty', :type_multistring, value)
  }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
serverspec-2.0.0.beta13 spec/type/windows/registry_key_spec.rb
serverspec-2.0.0.beta12 spec/type/windows/registry_key_spec.rb
serverspec-2.0.0.beta11 spec/type/windows/registry_key_spec.rb
serverspec-2.0.0.beta10 spec/type/windows/registry_key_spec.rb
serverspec-2.0.0.beta9 spec/type/windows/registry_key_spec.rb