Sha256: 69b7916ef85ddd1b5c33a4e60ab84279b84b6ea6f7587aa84eba354913d821b5

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

module Ahnsay
  describe ControllerMethods do
    describe "mixed in to a CallController" do

      class TestController < Adhearsion::CallController
        include Ahnsay::ControllerMethods
      end

      let(:mock_call) { mock 'Call' }
      let(:time) { Time.new(2012, 11, 10, 4, 15, 15) }
      let(:format) { 'dMY' }
      let(:number) { 42 }

      subject do
        TestController.new mock_call
      end

      before :each do
        Adhearsion.stub_chain("config.punchblock.platform").and_return(:foo)
        Adhearsion.stub_chain("config.ahnsay.sounds_dir").and_return("sounds")
      end

      describe "#sounds_for_time" do
        it "calls Ahnsay#sounds_for_time and returns the proper value" do
          subject.sounds_for_time(time, format: format).should == ["sounds/10.ul", "sounds/mon-10.ul", "sounds/20.ul", "sounds/12.ul"]
        end
      end

      describe "#sounds_for_number" do
        it "calls Ahnsay#sounds_for_number and returns the proper value" do
          subject.sounds_for_number(number).should == ["sounds/40.ul", "sounds/2.ul"]
        end
      end

      describe "#sounds_for_digits" do
        it "calls Ahnsay#sounds_for_digits and returns the proper value" do
          subject.sounds_for_digits(number).should == ["sounds/4.ul", "sounds/2.ul"]
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ahnsay-0.0.1 spec/ahnsay/controller_methods_spec.rb