Sha256: 00365e49bacc055551dbaede3c7ca8d6691485f97d9de0f1cabcbb6df9053906
Contents?: true
Size: 763 Bytes
Versions: 3
Compression:
Stored size: 763 Bytes
Contents
require 'letter_press_is_not_as_good_as_boggle' describe 'traversing the board' do it 'traverses each possibility, yielding the current word, current char and a recur object' do words = [] LetterPressIsNotAsGoodAsBoggle::BoardTraverser.new(%w[a b c]).each_with_recur do |word, char, recurser| word.should end_with char words << word recurser.call end words.should =~ %w[a b c ab ac abc acb ba bc bac bca ca cb cab cba] end it "recurses when called, and doesn't when not called" do words = [] LetterPressIsNotAsGoodAsBoggle::BoardTraverser.new(%w[a b c]).each_with_recur do |word, char, recurser| words << word recurser.call if word.end_with?("a") end words.should =~ %w[a b c ab ac] end end
Version data entries
3 entries across 3 versions & 1 rubygems