Skip to content
Snippets Groups Projects
Commit cb79509760f7 authored by DJ Mountney's avatar DJ Mountney
Browse files

Add support to our spec macros for stubbing generic package suffixes

Previously only ee was supported. But the new methods can stub any
suffix without us needing to add additional macros.
parent b17d00cfb841
No related branches found
No related tags found
2 merge requests!39Bumped oldstable branch to Heptapod 0.21,!31GitLab 13.10
......@@ -39,4 +39,17 @@
allow(ENV).to receive(:[]).with(var).and_return(value)
end
def stub_is_package_version(package, value)
allow(File).to receive(:read).with('VERSION').and_return(value ? "1.2.3-#{package}" : '1.2.3')
end
def stub_is_package_env(package, value)
stub_env_var(package, value.nil? ? '' : value.to_s)
end
def stub_is_package(package, value)
stub_is_package_version(package, value)
stub_is_package_env(package, value)
end
def stub_is_ee_version(value)
......@@ -42,5 +55,5 @@
def stub_is_ee_version(value)
allow(File).to receive(:read).with('VERSION').and_return(value ? '1.2.3-ee' : '1.2.3')
stub_is_package_version('ee', value)
end
def stub_is_ee_env(value)
......@@ -44,7 +57,7 @@
end
def stub_is_ee_env(value)
stub_env_var('ee', value.nil? ? '' : value.to_s)
stub_is_package_env('ee', value)
end
def stub_is_ee(value)
......@@ -48,8 +61,7 @@
end
def stub_is_ee(value)
stub_is_ee_version(value)
stub_is_ee_env(value)
stub_is_package('ee', value)
# Auto-deploys can not be non-EE. So, stubbing it to false for CE builds.
# However, since not all EE builds need to be auto-deploys, stubbing it
# to true needs to be done in a case-by-case manner.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment