Sha256: e7bd86a8eb09efa49c4875b23b3221aa790dad8c6935744198183d7cffbda6e2

Contents?: true

Size: 1.64 KB

Versions: 27

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'

RSpec.describe RubySMB::Fscc::FileSystemInformation::FileFsAttributeInformation 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_ATTRIBUTE_INFORMATION
  end

  subject(:struct) { described_class.new }

  it { should respond_to :file_system_attributes }
  it { should respond_to :maximum_component_name_length }
  it { should respond_to :file_system_name_length }
  it { should respond_to :file_system_name }

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

  it 'tracks the file system attributes in a struct field' do
    expect(struct.file_system_attributes).to be_a BinData::Struct
  end

  it 'tracks the maximum component name length in a Int32 field' do
    expect(struct.maximum_component_name_length).to be_a BinData::Int32le
  end

  it 'tracks the file system name length in a Uint32 field' do
    expect(struct.file_system_name_length).to be_a BinData::Uint32le
  end

  it 'tracks the file system name in a String16 field' do
    expect(struct.file_system_name).to be_a RubySMB::Field::String16
  end

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

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

Version data entries

27 entries across 27 versions & 1 rubygems

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