Sha256: 3e8051bab53261ea82cb324c39b443a6d2ad99f60cde1d506757365cf3c75bd9

Contents?: true

Size: 1.32 KB

Versions: 41

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

include SpecInfra::Helper::Cmd
include SpecInfra::Helper::Windows

describe user('test.user') do
  it { should exist }
  its(:command) { should eq "(FindUser -userName 'test.user') -ne $null" }
end

describe user('test.domain\test.user') do
  it { should exist }
  its(:command) { should eq "(FindUser -userName 'test.user' -domain 'test.domain') -ne $null" }
end

describe user('invalid-user') do
  it { should_not exist }
end

describe user('test.user') do
  it { should belong_to_group 'test.group' }
  its(:command) { should eq "(FindUserGroup -userName 'test.user' -groupName 'test.group') -ne $null" }
end

describe user('test.user.domain\test.user') do
  it { should belong_to_group 'test.group.domain\test.group' }
  its(:command) { should eq "(FindUserGroup -userName 'test.user' -userDomain 'test.user.domain' -groupName 'test.group' -groupDomain 'test.group.domain') -ne $null" }
end

describe user('test.user') do
  it { should_not belong_to_group 'invalid-group' }
end

describe user('test.user') do
  it "should raise error if command is not supported" do 
    {
      :have_uid => [nil],
      :have_login_shell => [nil],
      :have_authorized_key => [nil],
    }.each do |method, args|
      expect { should self.send(method, *args) }.to raise_error SpecInfra::Command::Windows::NotSupportedError
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
serverspec-1.0.0 spec/windows/user_spec.rb
serverspec-0.16.0 spec/windows/user_spec.rb
serverspec-0.15.5 spec/windows/user_spec.rb
serverspec-0.15.4 spec/windows/user_spec.rb
serverspec-0.15.3 spec/windows/user_spec.rb
serverspec-0.15.2 spec/windows/user_spec.rb
serverspec-0.15.1 spec/windows/user_spec.rb
serverspec-0.15.0 spec/windows/user_spec.rb
serverspec-0.14.4 spec/windows/user_spec.rb
serverspec-0.14.3 spec/windows/user_spec.rb
serverspec-0.14.2 spec/windows/user_spec.rb
serverspec-0.14.1 spec/windows/user_spec.rb
serverspec-0.14.0 spec/windows/user_spec.rb
serverspec-0.13.7 spec/windows/user_spec.rb
serverspec-0.13.6 spec/windows/user_spec.rb
serverspec-0.13.5 spec/windows/user_spec.rb
serverspec-0.13.4 spec/windows/user_spec.rb
serverspec-0.13.3 spec/windows/user_spec.rb
serverspec-0.13.2 spec/windows/user_spec.rb
serverspec-0.13.1 spec/windows/user_spec.rb