Sha256: cdce27d349eff04cb6f3dacc22b261c466d2ad7bf71afcc9dd9c437a5fff631d

Contents?: true

Size: 1.17 KB

Versions: 28

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

RSpec.describe RubySMB::SMB2::CreateContext do
  subject(:struct) { described_class.new }

  it { is_expected.to respond_to :next_offset }
  it { is_expected.to respond_to :name_offset }
  it { is_expected.to respond_to :name_length }
  it { is_expected.to respond_to :data_offset }
  it { is_expected.to respond_to :data_length }
  it { is_expected.to respond_to :name }
  it { is_expected.to respond_to :data }

  describe '#name_length' do
    it 'stores the length of the name field' do
      expect(struct.name_length).to eq struct.name.length
    end
  end

  describe '#name_offset' do
    it 'stores the relative offset of the name field' do
      expect(struct.name_offset).to eq struct.name.rel_offset
    end
  end

  describe '#data_length' do
    it 'stores the length of the data field' do
      expect(struct.data_length).to eq struct.data.length
    end
  end

  describe '#data_offset' do
    it 'stores the relative offset of the data field' do
      struct.data = 'Hello'
      expect(struct.data_offset).to eq struct.data.rel_offset
    end

    it 'returns 0 if the data field is empty' do
      expect(struct.data_offset).to eq 0
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ruby_smb-3.0.0 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.13 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.12 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.11 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.10 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.9 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.8 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.7 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.6 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.5 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.4 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.3 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.2 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.1 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-2.0.0 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-1.1.0 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-1.0.5 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-1.0.4 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-1.0.3 spec/lib/ruby_smb/smb2/create_context_spec.rb
ruby_smb-1.0.2 spec/lib/ruby_smb/smb2/create_context_spec.rb