Sha256: c437df7736074ff29fee949a6196d3d565da9b5a133604a4dd23e064b634caac

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 test/controllers/commits_controller_test.rb
shipit-engine-0.30.0 test/controllers/commits_controller_test.rb
shipit-engine-0.29.0 test/controllers/commits_controller_test.rb
shipit-engine-0.28.1 test/controllers/commits_controller_test.rb
shipit-engine-0.28.0 test/controllers/commits_controller_test.rb