Skip to content
代码片段 群组 项目
  • Miranda Fluharty's avatar
    bd50c602
    Raise artifacts bulk delete selection limit to 100 · bd50c602
    Miranda Fluharty 创作于
    Also refactor to use backend as single source of truth:
    Instead of defining a separate frontend SELECTED_ARTIFACTS_MAX_COUNT,
    use the helper to forward the JOB_ARTIFACTS_COUNT_LIMIT from the backend
    and provide it to the Vue app as jobArtifactsCountLimit
    
    Changelog: changed
    bd50c602
    历史
    Raise artifacts bulk delete selection limit to 100
    Miranda Fluharty 创作于
    Also refactor to use backend as single source of truth:
    Instead of defining a separate frontend SELECTED_ARTIFACTS_MAX_COUNT,
    use the helper to forward the JOB_ARTIFACTS_COUNT_LIMIT from the backend
    and provide it to the Vue app as jobArtifactsCountLimit
    
    Changelog: changed
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
artifacts_helper_spec.rb 1.06 KiB
# frozen_string_literal: true

require "spec_helper"

RSpec.describe ArtifactsHelper, feature_category: :build_artifacts do
  let_it_be(:user) { build_stubbed(:user) }
  let_it_be(:project) { build_stubbed(:project) }

  describe '#artifacts_app_data' do
    before do
      allow(helper).to receive(:current_user) { user }
      allow(helper).to receive(:can?).with(user, :destroy_artifacts, project).and_return(false)
    end

    subject { helper.artifacts_app_data(project) }

    it 'returns expected data' do
      expect(subject).to include({
        project_path: project.full_path,
        project_id: project.id,
        job_artifacts_count_limit: 100
      })
    end

    describe 'can_destroy_artifacts' do
      it 'returns false without permission' do
        expect(subject[:can_destroy_artifacts]).to eq('false')
      end

      it 'returns true when user has permission' do
        allow(helper).to receive(:can?).with(user, :destroy_artifacts, project).and_return(true)

        expect(subject[:can_destroy_artifacts]).to eq('true')
      end
    end
  end
end