Sha256: a975a2a8ff037805a061a44976eac9119f44e27f12ff85d8440da866e270183f
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe WordScramble::Descrambler do let(:descrambled) { WordScramble::Descrambler.new(@scrambled).matching_words } it "descrambles leloh" do @scrambled = "leloh" descrambled.should include("hello") end it "descrambles liopt" do @scrambled = "liopt" descrambled.should include("pilot") end it "descrambles realapin" do @scrambled = "realapin" descrambled.should include("airplane") end it "only returns words of the same length as the scrambled string" do @scrambled = "liopt" descrambled.select { |word| word.length != @scrambled.length }.should be_empty end it "doesnt crash with strings that are longer than any words in the dictionary" do @scrambled = "a" * 100 lambda {descrambled}.should_not raise_error end describe "same_length_words" do let(:descrambler) { WordScramble::Descrambler.new(@scrambled) } it "returns an array of words" do @scrambled = "fxo" descrambler.same_length_words.should include("fox") end it "returns an empty array if there are no words of the same length" do @scrambled = "a" * 100 descrambler.same_length_words.should be_empty end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
word_scramble-0.1.0 | spec/descrambler_spec.rb |