Sha256: 05d37c871a6752ccdf3a1749bdb1c2356281e0141b67cbc6bc1955f65e2dfb36
Contents?: true
Size: 1.68 KB
Versions: 3
Compression:
Stored size: 1.68 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe LittleWeasel do before do @spell = LittleWeasel::Checker.instance end it 'should create a LittleWeasel object' do @spell.should be_an_instance_of LittleWeasel::Checker end it 'should return true for valid word' do @spell.exists?('apple').should == true end it 'should return false for invalid word' do @spell.exists?('appel').should == false end it 'should return false for nil' do @spell.exists?(nil).should == false end it 'should return false for non-String' do @spell.exists?(:word).should == false end it 'should return true if option exclude_alphabet is false, and word is a letter' do @spell.options = {exclude_alphabet: false} @spell.exists?('x').should == true @spell.exists?('X').should == true end it 'should return false if option exclude_alphabet is true, and word is a letter' do @spell.options = {exclude_alphabet: true} @spell.exists?('x').should == false @spell.exists?('X').should == false end it 'should use options passed to exist? 1' do @spell.options = {exclude_alphabet: false} @spell.exists?('h', {exclude_alphabet: true}).should == false end it 'should use options passed to exist? 2' do @spell.options = {exclude_alphabet: true} @spell.exists?('h', {exclude_alphabet: false}).should == true end # TODO: Profile it "shouldn't take forever to find a lot of words" do words = %w{ all bad cap dad eat fad glad had inch jump kind lend monster on put quiet run sad tape under vector was xenophobe yes zebra } words *= 100 words.each { |word| @spell.exists?(word).should == true } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
LittleWeasel-1.0.2 | spec/checker/checker_spec.rb |
LittleWeasel-1.0.1 | spec/checker/checker_spec.rb |
LittleWeasel-1.0.0 | spec/checker/checker_spec.rb |