Sha256: d04f337c295a2277c625a3b664c724d25d6331a4333c6f4653edf163e02db8d4

Contents?: true

Size: 839 Bytes

Versions: 21

Compression:

Stored size: 839 Bytes

Contents

require 'test_helper'

class TaskDefinitionsTest < ActiveSupport::TestCase
  setup do
    @definition = TaskDefinition.new(
      'restart',
      'action' => 'Restart application',
      'description' => 'Restart app and job servers',
      'steps' => ['touch tmp/restart'],
    )
  end

  test ".load returns nil if payload is nil or blank" do
    assert_nil TaskDefinition.load('')
    assert_nil TaskDefinition.load(nil)
  end

  test ".dump returns nil if given nil" do
    assert_nil TaskDefinition.dump(nil)
  end

  test "serialization works" do
    as_json = {
      id: 'restart',
      action: 'Restart application',
      description: 'Restart app and job servers',
      steps: ['touch tmp/restart'],
      checklist: [],
    }
    assert_equal as_json, TaskDefinition.load(TaskDefinition.dump(@definition)).as_json
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
shipit-engine-0.5.2 test/models/task_definitions_test.rb
shipit-engine-0.5.1 test/models/task_definitions_test.rb
shipit-engine-0.5.0 test/models/task_definitions_test.rb
shipit-engine-0.4.10 test/models/task_definitions_test.rb
shipit-engine-0.4.9 test/models/task_definitions_test.rb
shipit-engine-0.4.8 test/models/task_definitions_test.rb
shipit-engine-0.4.7 test/models/task_definitions_test.rb
shipit-engine-0.4.6 test/models/task_definitions_test.rb
shipit-engine-0.4.5 test/models/task_definitions_test.rb
shipit-engine-0.4.4 test/models/task_definitions_test.rb
shipit-engine-0.4.3 test/models/task_definitions_test.rb
shipit-engine-0.4.2 test/models/task_definitions_test.rb
shipit-engine-0.4.1 test/models/task_definitions_test.rb
shipit-engine-0.4.0 test/models/task_definitions_test.rb
shipit-engine-0.3.1 test/models/task_definitions_test.rb
shipit-engine-0.3.0 test/models/task_definitions_test.rb
shipit-engine-0.2.3 test/models/task_definitions_test.rb
shipit-engine-0.2.2 test/models/task_definitions_test.rb
shipit-engine-0.2.1 test/models/task_definitions_test.rb
shipit-engine-0.2.0 test/models/task_definitions_test.rb