Sha256: 564ad34006eb4118dc1cc6cfc9d85a446d651410c6638844f58c00b564e9d32b

Contents?: true

Size: 1.02 KB

Versions: 121

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

class PSWindowsUserTest
  include PSWindows::User
end

describe PSWindowsUserTest do
  let( :wmic_output ) do <<-EOS




Name=Administrator





Name=bob foo





Name=bob-dash





Name=bob.foo





Name=cyg_server








EOS
  end
  let( :command )  { 'cmd /c echo "" | wmic useraccount where localaccount="true" get name /format:value' }
  let( :host ) { double.as_null_object }
  let( :result ) { Beaker::Result.new( host, command ) }

  describe '#user_list' do

    it 'returns user names list correctly' do
      result.stdout = wmic_output
      expect( subject ).to receive( :execute ).with( command ).and_yield(result)
      expect( subject.user_list ).to be === ['Administrator', 'bob foo', 'bob-dash', 'bob.foo', 'cyg_server']
    end

    it 'yields correctly with the result object' do
      result.stdout = wmic_output
      expect( subject ).to receive( :execute ).and_yield(result)
      subject.user_list { |result|
        expect( result.stdout ).to be === wmic_output
      }
    end

  end

end

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
beaker-4.30.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.29.1 spec/beaker/host/pswindows/user_spec.rb
beaker-4.29.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.28.1 spec/beaker/host/pswindows/user_spec.rb
beaker-4.28.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.27.1 spec/beaker/host/pswindows/user_spec.rb
beaker-4.27.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.26.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.25.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.24.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.23.2 spec/beaker/host/pswindows/user_spec.rb
beaker-4.23.1 spec/beaker/host/pswindows/user_spec.rb
beaker-4.23.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.22.1 spec/beaker/host/pswindows/user_spec.rb
beaker-4.22.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.21.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.20.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.19.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.18.0 spec/beaker/host/pswindows/user_spec.rb
beaker-4.17.0 spec/beaker/host/pswindows/user_spec.rb