Sha256: e0a90bbf1cde0e64d7e219539a19fae2b7437a2020f71a063651cd35b8fa9c88

Contents?: true

Size: 1.68 KB

Versions: 3

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

describe Adhearsion do
  describe "#ahn_root=" do
    it "should update properly the config root variable" do
      Adhearsion.ahn_root = "./"
      Adhearsion.config[:platform].root.should == Dir.getwd
    end

    it "should update properly the config root variable when path is nil" do
      Adhearsion.ahn_root = nil
      Adhearsion.config[:platform].root.should be_nil
    end
  end

  describe "#config" do
    it "should return a Configuration instance" do
      subject.config.should be_instance_of Adhearsion::Configuration
    end

    it "should execute a block" do
      foo = Object.new
      flexmock(foo).should_receive(:bar).once
      Adhearsion.config do |config|
        foo.bar
      end
    end
  end

  describe "#environments" do
    it "should be the collection of valid environments" do
      Adhearsion.config.valid_environments << :foo
      Adhearsion.environments.should include :foo
    end
  end

  describe "#router" do
    its(:router) { should be_a Adhearsion::Router }

    it "should always use the same router" do
      Adhearsion.router.should be Adhearsion.router
    end

    it "should pass a block along to the router" do
      foo = nil
      Adhearsion.router do
        foo = self
      end

      foo.should be Adhearsion.router
    end
  end

  describe "#active_calls" do
    it "should be a calls collection" do
      Adhearsion.active_calls.should be_a Adhearsion::Calls
    end

    it "should return the same instance each time" do
      Adhearsion.active_calls.should be Adhearsion.active_calls
    end
  end

  describe "#status" do
    it "should be the process status name" do
      Adhearsion.status.should == :booting
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhearsion-2.0.0.beta1 spec/adhearsion_spec.rb
adhearsion-2.0.0.alpha3 spec/adhearsion_spec.rb
adhearsion-2.0.0.alpha2 spec/adhearsion_spec.rb