Sha256: 76a68cf4a8c11da5b04d040878850aea20b34ea4916d7e2a0f26b235f423beb1

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

require 'spec_helper'
require 'hexdump/mixin'

describe Hexdump::Mixin do
  class TestMixin

    include Hexdump::Mixin

    def initialize(data)
      @data = data
    end

    def each_byte(&block)
      @data.each_byte(&block)
    end

  end

  let(:data)    { ("A" * 32) + ("B" * 32) + ("C" * 32) }
  let(:hexdump) { Hexdump::Hexdump.new.dump(data) }

  subject { TestMixin.new(data) }

  describe "#hexdump" do
    it "must write the hexdump lines of the object to $stdout" do
      expect {
        subject.hexdump
      }.to output(hexdump).to_stdout
    end
  end

  describe "#to_hexdump" do
    it "must return the hexdump lines of the object" do
      expect(subject.to_hexdump).to eq(hexdump)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hexdump-1.0.1 spec/mixin_spec.rb
hexdump-1.0.0 spec/mixin_spec.rb