Sha256: dc105ed60bdfb37d855376d8f9a4ecea0f51821a736486cc26f21d6bfe8f5250

Contents?: true

Size: 543 Bytes

Versions: 7

Compression:

Stored size: 543 Bytes

Contents

require 'test_helper'

module Pelusa
  describe Iterator do
    before do
      @last_node = nil
      @iterator  = Iterator.new do |node|
        @last_node = node if node == 3
      end

      @node = [ [ 1, [ 2, 3 ] ] ]
    end

    describe '#call' do
      it 'calls the iterator on a node' do
        @iterator.call(@node)
        @last_node.must_equal 3
      end
    end

    describe '#to_proc' do
      it 'calls the iterator on a node' do
        @iterator.to_proc[@node]
        @last_node.must_equal 3
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pelusa-0.2.2 test/pelusa/iterator_test.rb
pelusa-0.2.1 test/pelusa/iterator_test.rb
pelusa-0.2.0 test/pelusa/iterator_test.rb
pelusa-0.1.1 test/pelusa/iterator_test.rb
pelusa-0.1.0 test/pelusa/iterator_test.rb
pelusa-0.0.2 test/pelusa/iterator_test.rb
pelusa-0.0.1 test/pelusa/iterator_test.rb