Sha256: 0c3e7f62f49447fefa5459c7c94b7c2cb32b95fe0e59d0f315f8b984739dcd8a

Contents?: true

Size: 1.19 KB

Versions: 16

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8

require 'spec_helper'

module Adhearsion
  class CallController
    module MenuDSL

      describe RangeMatchCalculator do
        it "matching with a Range should handle the case of two potential matches in the range" do
          digits_that_begin_with_eleven = [110..119, 1100..1111].map { |x| Array(x) }.flatten
          calculator = RangeMatchCalculator.new 11..1111, :match_payload_doesnt_matter
          match = calculator.match '11'
          match.exact_matches.should be == ['11']
          match.potential_matches.should be == digits_that_begin_with_eleven
        end

        it "return values of #match should be an instance of CalculatedMatch" do
          calculator = RangeMatchCalculator.new 1..9, :match_payload_doesnt_matter
          calculator.match('0').should be_an_instance_of CalculatedMatch
          calculator.match('1000').should be_an_instance_of CalculatedMatch
        end

        it "returns a failed match if the query is not numeric or coercible to numeric" do
          calculator = RangeMatchCalculator.new 1..9, :match_payload_doesnt_matter
          calculator.match("ABC").should be_an_instance_of CalculatedMatch
        end
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
adhearsion-2.5.4 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.5.3 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.5.2 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.5.0 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.4.0 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.4.0.beta3 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.4.0.beta2 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.4.0.beta1 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.3.5 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.3.4 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.3.3 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.3.2 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.3.1 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.3.0 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.2.1 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb
adhearsion-2.2.0 spec/adhearsion/call_controller/menu_dsl/range_match_calculator_spec.rb