Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
postgres:
image: postgres:11
env:
POSTGRES_USER: $POSTGRES_USER
POSTGRES_USER: postgres
POSTGRES_DB: pastel_api_test
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_PASSWORD: postgres
ports: ["5432:5432"]

steps:
Expand All @@ -41,11 +41,15 @@ jobs:
env:
PGHOST: localhost
POSTGRES_DB: pastel_api_test
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY: ${{ secrets.ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY }}
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY: ${{ secrets.ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY }}
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT: ${{ secrets.ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT }}
DEVISE_JWT_SECRET_KEY: ${{ secrets.DEVISE_JWT_SECRET_KEY }}
DEVISE_JWT_EXPIRATION_TIME: ${{ secrets.DEVISE_JWT_EXPIRATION_TIME }}
CONTACT_EMAIL: ${{ secrets.CONTACT_EMAIL }}
WEB_BASE_URL: ${{ secrets.WEB_BASE_URL }}
RAILS_ENV: test
STAGING_ENV: 'false'
run: |
Expand All @@ -54,7 +58,7 @@ jobs:
# Run rspec command
- name: 🧪 Run tests
env:
CONTACT_EMAIL: $CONTACT_EMAIL
CONTACT_EMAIL: ${{ secrets.CONTACT_EMAIL }}
WEB_BASE_URL: ${{ secrets.WEB_BASE_URL }}
DEVISE_JWT_SECRET_KEY: ${{ secrets.DEVISE_JWT_SECRET_KEY }}
DEVISE_JWT_EXPIRATION_TIME: ${{ secrets.DEVISE_JWT_EXPIRATION_TIME }}
Expand All @@ -63,9 +67,9 @@ jobs:
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT: ${{ secrets.ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT }}
PGHOST: localhost
POSTGRES_DB: pastel_api_test
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
PGPORT: ${{ job.services.postgres.ports[5432] }}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGPORT: 5432
RAILS_ENV: test
STAGING_ENV: 'false'
run: bundle exec rspec --profile -f j -o tmp/rspec_results.json -f p
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ GEM
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.12.2)
json (2.13.2)
jwt (2.8.2)
base64
language_server-protocol (3.17.0.5)
Expand Down Expand Up @@ -244,7 +244,7 @@ GEM
ostruct (0.6.1)
pagy (9.3.5)
parallel (1.27.0)
parser (3.3.8.0)
parser (3.3.9.0)
ast (~> 2.4.1)
racc
path_expander (1.1.3)
Expand Down Expand Up @@ -314,7 +314,7 @@ GEM
parser (~> 3.3.0)
rainbow (>= 2.0, < 4.0)
rexml (~> 3.1)
regexp_parser (2.10.0)
regexp_parser (2.11.2)
reline (0.6.1)
io-console (~> 0.5)
responders (3.1.1)
Expand All @@ -339,18 +339,18 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.4)
rubocop (1.78.0)
rubocop (1.79.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.45.1, < 2.0)
rubocop-ast (>= 1.46.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.45.1)
rubocop-ast (1.46.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-checkstyle_formatter (0.6.0)
Expand Down Expand Up @@ -411,7 +411,7 @@ GEM
tty-which (0.5.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-display_width (3.1.5)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uniform_notifier (1.17.0)
Expand Down
6 changes: 6 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class Application < Rails::Application
config.active_record.encryption.primary_key = 'test_primary_key_for_testing_only'
config.active_record.encryption.deterministic_key = 'test_deterministic_key_for_testing_only'
config.active_record.encryption.key_derivation_salt = 'test_salt_for_testing_only'

# Set test environment variables for Devise JWT
ENV['DEVISE_JWT_SECRET_KEY'] = 'test_jwt_secret_key_for_testing_only'
ENV['DEVISE_JWT_EXPIRATION_TIME'] = '86400' # 24 hours in seconds
ENV['CONTACT_EMAIL'] = 'test@example.com'
ENV['WEB_BASE_URL'] = 'http://localhost:3000'
else
config.active_record.encryption.primary_key = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY')
config.active_record.encryption.deterministic_key = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY')
Expand Down
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
# See: https://guides.rubyonrails.org/active_record_encryption.html
config.active_record.encryption.encrypt_fixtures = true

# Ensure API mode is enabled in test environment
config.api_only = true

# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
end