Sha256: 09559e774f6be26b476b09b77ed742447f3fbf5c25fe303b05c86d23514d8f61

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true
require 'test_helper'

module Shipit
  class CommitsControllerTest < ActionController::TestCase
    setup do
      @stack = shipit_stacks(:shipit)
      @commit = shipit_commits(:first)
      @user = shipit_users(:walrus)
      session[:user_id] = @user.id
    end

    test "#update allows commits to be locked and sets the lock author" do
      refute_predicate(@commit, :locked?)

      patch(:update, params: {
        stack_id: @stack.to_param,
        id: @commit.id,
        commit: { locked: true },
      })

      assert_response(:ok)
      @commit.reload
      assert_predicate(@commit, :locked?)
      assert_equal(@user, @commit.lock_author)
    end

    test "#update allows commits to be unlocked and clears the lock author" do
      @commit.lock(@user)

      patch(:update, params: {
        stack_id: @stack.to_param,
        id: @commit.id,
        commit: { locked: false },
      })

      assert_response(:ok)
      @commit.reload
      refute_predicate(@commit, :locked?)
      assert_nil(@commit.lock_author_id)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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