1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

(test) verify env vars before running tests

This commit is contained in:
Sylvain 2023-04-03 11:41:43 +02:00
parent 7e71c8e3da
commit 7f4bd40dbf
2 changed files with 26 additions and 2 deletions

View File

@ -5,6 +5,10 @@
stripe_public_key=$(RAILS_ENV='test' bin/rails runner "puts ENV['STRIPE_PUBLISHABLE_KEY']")
stripe_secret_key=$(RAILS_ENV='test' bin/rails runner "puts ENV['STRIPE_API_KEY']")
oauth2_client_id=$(RAILS_ENV='test' bin/rails runner "puts ENV['OAUTH_CLIENT_ID']")
oauth2_client_secret=$(RAILS_ENV='test' bin/rails runner "puts ENV['OAUTH_CLIENT_SECRET']")
oidc_client_id=$(RAILS_ENV='test' bin/rails runner "puts ENV['OIDC_CLIENT_ID']")
oidc_client_secret=$(RAILS_ENV='test' bin/rails runner "puts ENV['OIDC_CLIENT_SECRET']")
if [[ -z "$stripe_public_key" ]]; then
read -rp "STRIPE_PUBLISHABLE_KEY is not set. Please input the public key now. > " stripe_public_key </dev/tty
if [[ -z "$stripe_public_key" ]]; then echo "Key was not set, exiting..."; exit 1; fi
@ -14,5 +18,25 @@ if [[ -z "$stripe_secret_key" ]]; then
read -rp "STRIPE_API_KEY is not set. Please input the secret key now. > " stripe_secret_key </dev/tty
if [[ -z "$stripe_secret_key" ]]; then echo "Key was not set, exiting..."; exit 1; fi
fi
if [[ -z "$oauth2_client_id" ]]; then
read -rp "OAUTH_CLIENT_ID is not set. Please input the client ID now. > " oauth2_client_id </dev/tty
if [[ -z "$oauth2_client_id" ]]; then echo "Key was not set, exiting..."; exit 1; fi
fi
STRIPE_PUBLISHABLE_KEY="$stripe_public_key" STRIPE_API_KEY="$stripe_secret_key" RAILS_ENV='test' bin/rails test "$@"
if [[ -z "$oauth2_client_secret" ]]; then
read -rp "OAUTH_CLIENT_SECRET is not set. Please input the client secret now. > " oauth2_client_secret </dev/tty
if [[ -z "$oauth2_client_secret" ]]; then echo "Key was not set, exiting..."; exit 1; fi
fi
if [[ -z "$oidc_client_id" ]]; then
read -rp "OIDC_CLIENT_ID is not set. Please input the client ID now. > " oidc_client_id </dev/tty
if [[ -z "$oidc_client_id" ]]; then echo "Key was not set, exiting..."; exit 1; fi
fi
if [[ -z "$oidc_client_secret" ]]; then
read -rp "OIDC_CLIENT_SECRET is not set. Please input the client secret now. > " oidc_client_secret </dev/tty
if [[ -z "$oidc_client_secret" ]]; then echo "Key was not set, exiting..."; exit 1; fi
fi
STRIPE_PUBLISHABLE_KEY="$stripe_public_key" STRIPE_API_KEY="$stripe_secret_key" \
OAUTH_CLIENT_ID="$oauth2_client_id" OAUTH_CLIENT_SECRET="$oauth2_client_secret" \
OIDC_CLIENT_ID="$oidc_client_id" OIDC_CLIENT_SECRET="$oidc_client_secret" RAILS_ENV='test' bin/rails test "$@"

View File

@ -93,7 +93,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
db_event.event_image.attachment.file.path
)
assert FileUtils.compare_file(
File.join(ActionDispatch::IntegrationTest.fixture_path, new_file),
File.join(ActionDispatch::IntegrationTest.fixture_path, "files/#{new_file}"),
db_event.event_files[0].attachment.file.path
)
end