summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-04-01 11:55:08 +1300
committerThong Kuah <tkuah@gitlab.com>2019-04-01 14:37:54 +1300
commit3a1a12b3833e28323347b1021a845a4d85beb563 (patch)
tree1a846c98824cddee1b932450c9d405f895d75f65
parenta2cfc150cec677b27728a4758e5e40fff5b4c284 (diff)
downloadgitlab-ce-3a1a12b3833e28323347b1021a845a4d85beb563.tar.gz
Fix cert_manager_spec to not modify String
Also break up long string to be readable
-rw-r--r--spec/models/clusters/applications/cert_manager_spec.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/spec/models/clusters/applications/cert_manager_spec.rb b/spec/models/clusters/applications/cert_manager_spec.rb
index fefeb8fd75f..af7eadfc74c 100644
--- a/spec/models/clusters/applications/cert_manager_spec.rb
+++ b/spec/models/clusters/applications/cert_manager_spec.rb
@@ -11,7 +11,27 @@ describe Clusters::Applications::CertManager do
include_examples 'cluster application initial status specs'
describe '#install_command' do
- let(:cluster_issuer_file) { { "cluster_issuer.yaml": "---\napiVersion: certmanager.k8s.io/v1alpha1\nkind: ClusterIssuer\nmetadata:\n name: letsencrypt-prod\nspec:\n acme:\n server: https://acme-v02.api.letsencrypt.org/directory\n email: admin@example.com\n privateKeySecretRef:\n name: letsencrypt-prod\n http01: {}\n" } }
+ let(:cert_email) { 'admin@example.com' }
+
+ let(:cluster_issuer_file) do
+ file_contents = <<~EOF
+ ---
+ apiVersion: certmanager.k8s.io/v1alpha1
+ kind: ClusterIssuer
+ metadata:
+ name: letsencrypt-prod
+ spec:
+ acme:
+ server: https://acme-v02.api.letsencrypt.org/directory
+ email: #{cert_email}
+ privateKeySecretRef:
+ name: letsencrypt-prod
+ http01: {}
+ EOF
+
+ { "cluster_issuer.yaml": file_contents }
+ end
+
subject { cert_manager.install_command }
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
@@ -26,9 +46,10 @@ describe Clusters::Applications::CertManager do
end
context 'for a specific user' do
+ let(:cert_email) { 'abc@xyz.com' }
+
before do
- cert_manager.email = 'abc@xyz.com'
- cluster_issuer_file[:'cluster_issuer.yaml'].gsub! 'admin@example.com', 'abc@xyz.com'
+ cert_manager.email = cert_email
end
it 'should use his/her email to register issuer with certificate provider' do