Sha256: 82a30fa21c89c8d986619e939373684a38aa46985ec89a3e31a315e6ce2dc356

Contents?: true

Size: 1.28 KB

Versions: 7

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8

require 'spec_helper'

module Adhearsion
  class CallController
    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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adhearsion-2.1.3 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.1.2 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.1.1 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.1.0 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.1 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0.rc5 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb