Sha256: 17d00e60f873dfec5d97a3840b8d0a3f2c27f08c4c0bbb3623e30f270b243dc3

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

module AirPlayer
  describe Device do
    let (:device) do
      AirPlayer::Device
    end

    before do
      Airplay.devices << double_device
    end

    describe '#devices' do
      it 'returns array' do
        expect(device.devices).to be_kind_of Array
      end
    end

    describe '#get' do
      context 'with exist device number' do
        it 'returns instance of device' do
          expect(device.get(0)).to be_kind_of Airplay::Device
        end
      end

      context 'with not exist device number' do
        it 'returns default device and display message' do
          default_device = nil
          message = capture(:stdout) { default_device = device.get(99) }
          expect(default_device).to eq device.default
          expect(message).to match('Device number 99 is not found')
        end
      end
    end

    describe '#exist?' do
      context 'with exist device number' do
        it 'returns true' do
          expect(device.exist?(0)).to be true
        end
      end

      context 'with not exist device number' do
        it 'returns false' do
          expect(device.exist?(99)).to be false
        end
      end
    end

    describe '#default' do
      it 'returns first airplay device' do
        expect(device.default).to eq Airplay.devices.first
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
airplayer-1.0.1 spec/airplayer/device_spec.rb
airplayer-1.0.0 spec/airplayer/device_spec.rb
airplayer-1.0.0.pre spec/airplayer/device_spec.rb
airplayer-0.1.0 spec/airplayer/device_spec.rb
airplayer-0.0.9 spec/airplayer/device_spec.rb