Sha256: 9f94c46e618f4246c24949270263e1c12b35be7e9835742beb4cbc4abee356a9

Contents?: true

Size: 1.2 KB

Versions: 16

Compression:

Stored size: 1.2 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.should be_potential_match
          match.should_not be_exact_match
          match.potential_matches.should be == [444]
        end

        it "a multi-digit exact match scenario" do
          calculator = FixnumMatchCalculator.new(5555, match_payload)
          match = calculator.match '5555'
          match.should be_exact_match
        end

        it "a single-digit exact match scenario" do
          calculator = FixnumMatchCalculator.new(1, match_payload)
          match = calculator.match '1'
          match.should be_exact_match
        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

16 entries across 16 versions & 1 rubygems

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