Sha256: 710dda1ede35818f03082a01f413378d12f8a736fb1e98ebaa84c7b4a6dca4b6

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

module Adhearsion
  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 == [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

Version data entries

4 entries across 4 versions & 1 rubygems

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