Sha256: c49169c6f03ce76d1bee897b3892eb7252ed02bb441da440c4ec746b25c355d8

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

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 == [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 == [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 == special_digit
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adhearsion-2.0.0.beta1 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0.alpha3 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0.alpha2 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb
adhearsion-2.0.0.alpha1 spec/adhearsion/menu_dsl/string_match_calculator_spec.rb