Sha256: 6838a719a70685cc180c3cfa3d48e96d1a4c4a44802de8bb6779e7cdda1a82fe

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

require 'spec_helper'

require 'hexdump'

describe Hexdump do
  describe "#hexdump" do
    let(:bytes) { [104, 101, 108, 108, 111] }
    let(:hex_chars) { ['68', '65', '6c', '6c', '6f'] }

    subject do
      obj = Object.new.extend(Hexdump)

      each_byte = expect(obj).to receive(:each_byte)
      bytes.each do |b|
        each_byte = each_byte.and_yield(b)
      end

      obj
    end

    it "should hexdump the object" do
      chars = []

      subject.hexdump do |index,hex,print|
        chars += hex
      end

      expect(chars).to be == hex_chars
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hexdump-0.2.4 spec/hexdump_spec.rb