Sha256: ac3ed8d6201b5d4ff77e7f88e7da32220845c2cbbd115ba990de341ac26575bb

Contents?: true

Size: 845 Bytes

Versions: 8

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'

module Shipit
  module Api
    class CommitsControllerTest < ActionController::TestCase
      setup do
        @stack = shipit_stacks(:shipit)
        authenticate!
      end

      test "#index returns a list of commits" do
        commit = @stack.commits.reachable.last

        get :index, params: { stack_id: @stack.to_param }
        assert_response :ok
        assert_json '0.sha', commit.sha
      end

      test "#index with undeployed=1 returns a list of undeployed commits" do
        commits = @stack.undeployed_commits.pluck(:sha)

        get :index, params: { stack_id: @stack.to_param, undeployed: 1 }
        assert_response :ok
        JSON.parse(response.body).each do |commit|
          assert commits.include?(commit.fetch("sha"))
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shipit-engine-0.37.0 test/controllers/api/commits_controller_test.rb
shipit-engine-0.36.1 test/controllers/api/commits_controller_test.rb
shipit-engine-0.36.0 test/controllers/api/commits_controller_test.rb
shipit-engine-0.35.1 test/controllers/api/commits_controller_test.rb
shipit-engine-0.35.0 test/controllers/api/commits_controller_test.rb
shipit-engine-0.34.0 test/controllers/api/commits_controller_test.rb
shipit-engine-0.33.0 test/controllers/api/commits_controller_test.rb
shipit-engine-0.32.0 test/controllers/api/commits_controller_test.rb