Sha256: ed4ec8f44e42727515d6236cbc5822ef7347516e9c4ff582920ee583ba2b2f7a

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8

require 'spec_helper'

module Adhearsion
  module MenuDSL
    describe StringMatchCalculator do

      let(:match_payload) { :doesnt_matter }

      it "numerical digits mixed with special digits" do
        %w[5*11#3 5*** ###].each do |str|
          calculator = StringMatchCalculator.new str, match_payload

          match_case = calculator.match str[0,2]
          match_case.exact_match?.should_not be true
          match_case.potential_match?.should be true
          match_case.potential_matches.should be == [str]

          match_case = calculator.match str
          match_case.exact_match?.should be true
          match_case.potential_match?.should_not be true
          match_case.exact_matches.should be == [str]
        end
      end

      it "matching the special DTMF characters such as * and #" do
        %w[* #].each do |special_digit|
          calculator = StringMatchCalculator.new(special_digit, match_payload)
          match_case = calculator.match special_digit
          match_case.potential_match?.should_not be true
          match_case.exact_match?.should be true
          match_case.exact_matches.first.should be == special_digit
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adhearsion-2.0.0.rc4 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0.rc3 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0.rc2 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0.rc1 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb