Sha256: c898ee3c880747567711f8e4724e5565cc7f19078388402a932dc529dd20bedc

Contents?: true

Size: 1.01 KB

Versions: 121

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

class WindowsUserTest
  include Windows::User
end

describe WindowsUserTest 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.42.0 spec/beaker/host/windows/user_spec.rb
beaker-4.41.2 spec/beaker/host/windows/user_spec.rb
beaker-4.41.1 spec/beaker/host/windows/user_spec.rb
beaker-4.41.0 spec/beaker/host/windows/user_spec.rb
beaker-4.40.2 spec/beaker/host/windows/user_spec.rb
beaker-4.40.1 spec/beaker/host/windows/user_spec.rb
beaker-4.40.0 spec/beaker/host/windows/user_spec.rb
beaker-4.39.0 spec/beaker/host/windows/user_spec.rb
beaker-4.38.1 spec/beaker/host/windows/user_spec.rb
beaker-4.38.0 spec/beaker/host/windows/user_spec.rb
beaker-4.37.2 spec/beaker/host/windows/user_spec.rb
beaker-4.37.1 spec/beaker/host/windows/user_spec.rb
beaker-4.37.0 spec/beaker/host/windows/user_spec.rb
beaker-4.36.1 spec/beaker/host/windows/user_spec.rb
beaker-4.36.0 spec/beaker/host/windows/user_spec.rb
beaker-4.35.0 spec/beaker/host/windows/user_spec.rb
beaker-4.34.0 spec/beaker/host/windows/user_spec.rb
beaker-4.33.0 spec/beaker/host/windows/user_spec.rb
beaker-4.32.0 spec/beaker/host/windows/user_spec.rb
beaker-4.31.0 spec/beaker/host/windows/user_spec.rb