Sha256: 7ea9c0a1d308666bc105f831fcc7a0102983bb949332a33bf60bd89bd2bf0be2

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 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)

      stub = obj.stub!(:each_byte)
      bytes.each { |b| stub = stub.and_yield(b) }

      obj
    end

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

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

      chars.should == hex_chars
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hexdump-0.2.3 spec/hexdump_spec.rb
hexdump-0.2.1 spec/hexdump_spec.rb