summaryrefslogtreecommitdiff
path: root/spec/helpers/projects_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
commite8d2c2579383897a1dd7f9debd359abe8ae8373d (patch)
treec42be41678c2586d49a75cabce89322082698334 /spec/helpers/projects_helper_spec.rb
parentfc845b37ec3a90aaa719975f607740c22ba6a113 (diff)
downloadgitlab-ce-e8d2c2579383897a1dd7f9debd359abe8ae8373d.tar.gz
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/helpers/projects_helper_spec.rb')
-rw-r--r--spec/helpers/projects_helper_spec.rb33
1 files changed, 32 insertions, 1 deletions
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index 1804a9a99cf..75e80f5edbc 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -138,7 +138,7 @@ RSpec.describe ProjectsHelper do
end
end
- describe "#project_list_cache_key", :clean_gitlab_redis_shared_state do
+ describe "#project_list_cache_key", :clean_gitlab_redis_cache do
let(:project) { project_with_repo }
before do
@@ -876,6 +876,37 @@ RSpec.describe ProjectsHelper do
end
end
+ describe '#show_terraform_banner?' do
+ let_it_be(:ruby) { create(:programming_language, name: 'Ruby') }
+ let_it_be(:hcl) { create(:programming_language, name: 'HCL') }
+
+ subject { helper.show_terraform_banner?(project) }
+
+ before do
+ create(:repository_language, project: project, programming_language: language, share: 1)
+ end
+
+ context 'the project does not contain terraform files' do
+ let(:language) { ruby }
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'the project contains terraform files' do
+ let(:language) { hcl }
+
+ it { is_expected.to be_truthy }
+
+ context 'the project already has a terraform state' do
+ before do
+ create(:terraform_state, project: project)
+ end
+
+ it { is_expected.to be_falsey }
+ end
+ end
+ end
+
describe '#project_title' do
subject { helper.project_title(project) }