Sha256: 055261ae3d5c84134f37e1c03cd2177b8a9518a58a3f8b92966033fb7a85dd05

Contents?: true

Size: 895 Bytes

Versions: 20

Compression:

Stored size: 895 Bytes

Contents

require 'test_helper'

class Api::TasksControllerTest < ActionController::TestCase
  setup do
    @stack = stacks(:shipit)
    authenticate!
  end

  test "#index returns a list of tasks" do
    task = @stack.tasks.last

    get :index, stack_id: @stack.to_param
    assert_response :ok
    assert_json '0.id', task.id
  end

  test "#show returns a task" do
    task = @stack.tasks.last

    get :show, stack_id: @stack.to_param, id: task.id
    assert_response :ok
    assert_json 'id', task.id
  end

  test "#trigger triggers a custom task" do
    post :trigger, stack_id: @stack.to_param, task_name: 'restart'
    assert_response :accepted
    assert_json 'type', 'task'
    assert_json 'status', 'pending'
  end

  test "#trigger returns a 404 when the task doesn't exist" do
    post :trigger, stack_id: @stack.to_param, task_name: 'doesnt_exist'
    assert_response :not_found
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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