Sha256: 4c27239acdb5b75efe711e62777cd88c4e641a3f79c026190486d6de18da2bc2

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

require 'spec_helper'

module Adhearsion
  class CallController
    module MenuDSL
      describe FixnumMatchCalculator do
        let(:match_payload) { :main }

        it "a potential match scenario" do
          calculator = FixnumMatchCalculator.new(444, match_payload)
          match = calculator.match 4
          match.potential_match?.should be true
          match.exact_match?.should_not be true
          match.potential_matches.should be == [444]
        end

        it "a multi-digit exact match scenario" do
          calculator = FixnumMatchCalculator.new(5555, match_payload)
          calculator.match(5555).exact_match?.should be true
        end

        it "a single-digit exact match scenario" do
          calculator = FixnumMatchCalculator.new(1, match_payload)
          calculator.match(1).exact_match?.should be true
        end

        it "the context name given to the calculator should be passed on the CalculatedMatch" do
          match_payload = :icanhascheezburger
          calculator = FixnumMatchCalculator.new(1337, match_payload)
          calculator.match(1337).match_payload.should be match_payload
        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/fixnum_match_calculator_spec.rb
adhearsion-2.1.2 spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb
adhearsion-2.1.1 spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb
adhearsion-2.1.0 spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb
adhearsion-2.0.1 spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb
adhearsion-2.0.0 spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb
adhearsion-2.0.0.rc5 spec/adhearsion/call_controller/menu_dsl/fixnum_match_calculator_spec.rb