Sha256: 9395767c7804ee180070724773728ef38d2ebbf2bb7c62560cb5421ec1bafb64

Contents?: true

Size: 1.92 KB

Versions: 2

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'

describe :AirPlayer do
  context :App do
    let(:app) { AirPlayer::App.new }

    it 'class type is Thor' do
      expect(app).to be_kind_of Thor
    end
  end

  context :Logger do
    it 'file path is /tmp/airplayer-access.log on Linux' do
      if RbConfig::CONFIG['target_os'] =~ /linux|unix/
        expect(AirPlayer::Logger.path).to eq '/tmp/airplayer-access.log'
      end
    end
  end

  context :Media do
    it 'check supported mime types' do
      expect(AirPlayer::Media.playable?('007 SKYFALL.mp4')).to be_true
      expect(AirPlayer::Media.playable?('007 SKYFALL.ts')).to be_true
      expect(AirPlayer::Media.playable?('007 SKYFALL.m4v')).to be_true
      expect(AirPlayer::Media.playable?('007 SKYFALL.mov')).to be_true
      expect(AirPlayer::Media.playable?('007 SKYFALL.ts')).to be_true
      expect(AirPlayer::Media.playable?('007 SKYFALL.flv')).to be_false
      expect(AirPlayer::Media.playable?('007 SKYFALL.wmv')).to be_false
      expect(AirPlayer::Media.playable?('.DS_Store')).to be_false
    end
    it 'give to local file' do
      media = AirPlayer::Media.new('./Gemfile')
      expect(media.file?).to be_true
    end
    it 'give to url' do
      media = AirPlayer::Media.new('http://example.com/video.mp4')
      expect(media.url?).to be_true
    end 
  end

  context :Playlist do
    let(:playlist) { AirPlayer::Playlist.new }

    it 'add URL to list, and that media type is url' do
      playlist.add('http://example.com/video.mp4')
      expect(playlist.first.path).to match 'http'
    end

    it 'add file to list, and that media type is file' do
      expect(playlist.add('./LICENSE').size).to eq 1
      expect(playlist.add('./Gemfile').size).to eq 2
      expect(playlist.first.file?).to be_true
    end

    it 'has list contains url or file path' do
      playlist.add('../airplayer')
      playlist.entries do |media|
        expect(media).to be_kind_of AirPlayer::Media
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
airplayer-0.0.5 spec/airplayer_spec.rb
airplayer-0.0.4 spec/airplayer_spec.rb