Sha256: 3008ea09f50cd66656319b730f758f23cfa82b4f82b9df170a3bb007ec28132f

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

include Mac::Skype

describe Agent do
  subject do
    Agent.instance
  end

  after do
    if subject.is_a?(Agent)
      subject.disconnect
    end
  end

  it 'is singleton class' do
    lambda do
      Agent.new
    end.should raise_error

    Agent.instance.should equal(Agent.instance)
  end

  describe '#skype_running?' do
    its(:skype_running?) { should be_true }
  end

  describe '#name' do
    its(:name) { should eql('mac-skype') }
  end

  describe '#connect' do
    it 'should connect' do
      subject.should_not be_connected

      subject.connect

      subject.should be_connected
    end
  end

  describe '#disconnect' do
    before do
      subject.connect
    end

    it 'should disconnect' do
      subject.should be_connected

      subject.disconnect

      subject.should_not be_connected
    end
  end

  describe '#send_command' do
    before do
      subject.connect
    end

    it 'should send command' do
      subject.send_command('PROTOCOL 9999').should match(/^PROTOCOL \d+$/)
      subject.send_command('FOO').should eql('ERROR 2 Unknown command')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mac-skype-0.0.3-x86_64-darwin-13 spec/mac-skype/agent_spec.rb
mac-skype-0.0.2-x86_64-darwin-11 spec/mac-skype/agent_spec.rb
mac-skype-0.0.1-x86_64-darwin-11 spec/mac-skype/agent_spec.rb