diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 21:16:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 21:16:10 +0300 |
commit | d2f2219fd58e572c10d77183e2f65de8fcc8df96 (patch) | |
tree | 2cde75cd3d994b7febe1349ab61b7a94a95c78cf /spec/helpers | |
parent | 6323146895db2be6f04846b3c98060b7349207b9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/environments_helper_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/helpers/environments_helper_spec.rb b/spec/helpers/environments_helper_spec.rb index 14f99f144b2..2aae7b61bd1 100644 --- a/spec/helpers/environments_helper_spec.rb +++ b/spec/helpers/environments_helper_spec.rb @@ -3,9 +3,12 @@ require 'spec_helper' RSpec.describe EnvironmentsHelper, feature_category: :environment_management do + include ActionView::Helpers::AssetUrlHelper + + folder_name = 'env_folder' let_it_be(:user) { create(:user) } let_it_be(:project, reload: true) { create(:project, :repository) } - let_it_be(:environment) { create(:environment, project: project) } + let_it_be(:environment) { create(:environment, :with_folders, folder: folder_name, project: project) } describe '#metrics_data', feature_category: :metrics do before do @@ -95,4 +98,23 @@ RSpec.describe EnvironmentsHelper, feature_category: :environment_management do expect(subject).to eq(true) end end + + describe '#environments_folder_list_view_data' do + subject { helper.environments_folder_list_view_data(project, folder_name) } + + before do + allow(helper).to receive(:current_user).and_return(user) + allow(helper).to receive(:can?).and_return(true) + end + + it 'returns folder related data' do + expect(subject).to include( + 'endpoint' => folder_project_environments_path(project, folder_name, format: :json), + 'can_read_environment' => 'true', + 'project_path' => project.full_path, + 'folder_name' => folder_name, + 'help_page_path' => '/help/ci/environments/index' + ) + end + end end |