Sha256: 4cf23aa2c0b842b1ba0b4c488a42b2fa107a511be571b919d51e995c15fc5375

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

require_relative '../spec_helper'

def plist
  <<-EOS
<?xml version="1.0"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <array>
    <key>name</key>
    <string>specification name</string>
    <key>notificationEmail</key>
    <string>email@example.com</string>
    <key>taskSpecifications</key>
    <dict>
      <key>name</key>
      <string>task name</string>
      <dict>
        <key>arguments</key>
        <array>
          <string>hello</string>
        </array>
        <key>command</key>
        <string>/bin/echo</string>
        <key>dependsOnTasks</key>
        <array>
          <string>another task</string>
        </array>
      </dict>
    </dict>
  </array>
</plist>
  EOS
end

describe Girdle::Specification do
  
  before do
    @spec = Girdle::Specification.new(
      name: 'specification name',
      notification_email: 'email@example.com',
      tasks: [
        Girdle::Task.new(
          name: 'task name', 
          command: '/bin/echo', 
          arguments: ['hello'], 
          depends_on: ['another task']
        )
      ]
    )
  end
  
  it 'must have name, notification_email, tasks and depends_on accessors' do
    @spec.name.must_equal 'specification name'
    @spec.notification_email.must_equal 'email@example.com'
    @spec.tasks.size.must_equal 1
  end
  
  it 'must append tasks' do
    @spec.tasks.size.must_equal 1
    @spec.tasks << Girdle::Task.new
    @spec.tasks.size.must_equal 2
  end
  
  it 'must render itself as a plist' do
    @spec.to_plist.must_equal plist
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
girdle-0.0.3 spec/girdle/specification_spec.rb
girdle-0.0.2 spec/girdle/specification_spec.rb
girdle-0.0.1 spec/girdle/specification_spec.rb