Sha256: 71af714f247dba1fd9d9571e3c7463f02aa6cf7f9e8fc28859f9c6dd52b05bd7

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

$:.unshift File.dirname(__FILE__)

require 'spec_helper'
require 'osx/cocoa'

include OSX
OSX.require_framework 'ScriptingBridge'

describe ITunesObserver do
  before do
    @itunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")
    raise 'iTunes must be running' unless @itunes.isRunning
    @result = nil
    @observer = ITunesObserver.new do |result|
      @result = result
    end

    @itunes.stop
  end

  after do
    @itunes.stop
  end

  it "should observe playing" do
    @itunes.playpause
    @observer.run(1)
    @result.should_not be_nil
    @result['Name'].should_not be_nil
    @result['Player State'].should eql('Playing')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itunes-observer-0.0.3 spec/itunes_observer_spec.rb
itunes-observer-0.0.2 spec/itunes_observer_spec.rb