Sha256: 1ec1eaae64e73fd87b9cb33d65f9d387e7c026eb44a678cfcc7851284427cf7a

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 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]
            expect(match_case).not_to be_exact_match
            expect(match_case).to be_potential_match
            expect(match_case.potential_matches).to eq([str])

            match_case = calculator.match str
            expect(match_case).to be_exact_match
            expect(match_case).not_to be_potential_match
            expect(match_case.exact_matches).to eq([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
            expect(match_case.exact_matches.first).to eq(special_digit)
            expect(match_case).to be_exact_match
            expect(match_case).not_to be_potential_match
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adhearsion-2.6.4 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.6.3 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.6.2 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.6.1 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.6.0 spec/adhearsion/call_controller/menu_dsl/string_match_calculator_spec.rb