Sha256: f95106afdefa701438c9ba38faabbbac8ef741a1ecb159eda0de519f33550f57

Contents?: true

Size: 1.73 KB

Versions: 28

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'

RSpec.describe RubySMB::Fscc::FileSystemInformation::FileFsVolumeInformation do
  it 'references the correct class level' do
    expect(described_class).to be_const_defined(:CLASS_LEVEL)
    expect(described_class::CLASS_LEVEL).to be RubySMB::Fscc::FileSystemInformation::FILE_FS_VOLUME_INFORMATION
  end

  subject(:struct) { described_class.new }

  it { should respond_to :volume_creation_time }
  it { should respond_to :volume_serial_number }
  it { should respond_to :volume_label_length }
  it { should respond_to :supports_objects }
  it { should respond_to :volume_label }

  it 'is little endian' do
    expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
  end

  it 'tracks the volume creation time in a FileTime field' do
    expect(struct.volume_creation_time).to be_a RubySMB::Field::FileTime
  end

  it 'tracks the volume serial number in a Uint32 field' do
    expect(struct.volume_serial_number).to be_a BinData::Uint32le
  end

  it 'tracks the volume label length in a Uint32 field' do
    expect(struct.volume_label_length).to be_a BinData::Uint32le
  end

  it 'tracks if it supports objects in a Uint8 field' do
    expect(struct.supports_objects).to be_a BinData::Uint8
  end

  it 'tracks the volume label in a String16 field' do
    expect(struct.volume_label).to be_a RubySMB::Field::String16
  end

  it 'tracks the length of the volume_label field' do
    struct.volume_label = 'NTFS'
    expect(struct.volume_label_length).to eq struct.volume_label.do_num_bytes
  end

  it 'automatically encodes the file system name in UTF-16LE' do
    name = 'NTFS'
    struct.volume_label = name
    expect(struct.volume_label.force_encoding('utf-16le')).to eq name.encode('utf-16le')
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ruby_smb-3.3.13 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.12 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.11 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.10 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.9 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.7 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.6 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.5 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.4 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.3 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.2 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.1 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.3.0 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.2.8 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.2.7 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.2.6 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.2.5 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.2.4 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.2.3 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb
ruby_smb-3.2.2 spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb