Sha256: e664df14d1704ce446223d1e088e7d98e7e3ce173c5de16a1b29d75629554e40

Contents?: true

Size: 1.31 KB

Versions: 37

Compression:

Stored size: 1.31 KB

Contents

require 'test_helper'

module Shipit
  class CommitDeploymentTest < ActiveSupport::TestCase
    setup do
      @deployment = shipit_commit_deployments(:shipit_pending_fourth)
      @commit = @deployment.commit
      @task = @deployment.task
      @stack = @task.stack
      @author = @deployment.author
    end

    test "there can only be one record per deploy and commit pair" do
      assert_raises ActiveRecord::RecordNotUnique do
        CommitDeployment.create!(task: @deployment.task, commit: @deployment.commit)
      end
    end

    test "creation on GitHub" do
      pull_request_response = stub(head: stub(sha: '6dcb09b5b57875f334f61aebed695e2e4193db5e'))
      @author.github_api.expects(:pull_request).with('shopify/shipit-engine', 7).returns(pull_request_response)

      deployment_response = stub(id: 42, url: 'https://example.com')
      @author.github_api.expects(:create_deployment).with(
        'shopify/shipit-engine',
        pull_request_response.head.sha,
        auto_merge: false,
        required_contexts: [],
        description: "Via Shipit",
        environment: @stack.environment,
      ).returns(deployment_response)

      @deployment.create_on_github!
      assert_equal deployment_response.id, @deployment.github_id
      assert_equal deployment_response.url, @deployment.api_url
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
shipit-engine-0.29.0 test/models/commit_deployment_test.rb
shipit-engine-0.28.1 test/models/commit_deployment_test.rb
shipit-engine-0.28.0 test/models/commit_deployment_test.rb
shipit-engine-0.27.1 test/models/commit_deployment_test.rb
shipit-engine-0.27.0 test/models/commit_deployment_test.rb
shipit-engine-0.26.0 test/models/commit_deployment_test.rb
shipit-engine-0.25.1 test/models/commit_deployment_test.rb
shipit-engine-0.25.0 test/models/commit_deployment_test.rb
shipit-engine-0.24.0 test/models/commit_deployment_test.rb
shipit-engine-0.23.1 test/models/commit_deployment_test.rb
shipit-engine-0.23.0 test/models/commit_deployment_test.rb
shipit-engine-0.22.0 test/models/commit_deployment_test.rb
shipit-engine-0.21.0 test/models/commit_deployment_test.rb
shipit-engine-0.20.1 test/models/commit_deployment_test.rb
shipit-engine-0.20.0 test/models/commit_deployment_test.rb
shipit-engine-0.19.0 test/models/commit_deployment_test.rb
shipit-engine-0.18.1 test/models/commit_deployment_test.rb
shipit-engine-0.18.0 test/models/commit_deployment_test.rb
shipit-engine-0.17.0 test/models/commit_deployment_test.rb
shipit-engine-0.16.0 test/models/commit_deployment_test.rb