Sha256: 98367e8d5208fd7dd46ed8a4b59ea4fc4aa90da1a157a148236e2f39d8de06c5

Contents?: true

Size: 658 Bytes

Versions: 6

Compression:

Stored size: 658 Bytes

Contents

require_relative '../helper'
require_relative 'human_typo'

class HumanTypoTest < Test::Unit::TestCase
  def setup
    @input = 'spec/services/anything_spec'
    @sh = TreeSpell::HumanTypo.new(@input, lambda: 0.05)
    @len = @input.length
  end

  def test_changes
    # srand seed ensures all four actions are called
    srand 247_696_449
    sh = TreeSpell::HumanTypo.new(@input, lambda: 0.20)
    word_error = sh.call
    assert_equal word_error, 'spec/suervcieq/anythin_gpec'
  end

  def test_check_input
    assert_raise(RuntimeError, "input length must be greater than 5 characters: tiny") do
      TreeSpell::HumanTypo.new('tiny')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
did_you_mean-2.0.0 test/tree_spell/test_human_typo.rb
did_you_mean-1.6.3 test/tree_spell/test_human_typo.rb
did_you_mean-1.6.2 test/tree_spell/test_human_typo.rb
did_you_mean-1.6.1 test/tree_spell/test_human_typo.rb
did_you_mean-1.5.0 test/tree_spell/test_human_typo.rb
did_you_mean-1.4.0 test/tree_spell/test_human_typo.rb