Skip to content

Commit

Permalink
Pull the latest commit (CI test database) to pass CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzz212zzZ committed Feb 26, 2024
2 parents e7f87f7 + df7464e commit 77705b0
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
env:
DB_USER: postgres
DB_PASSWORD: password
RAILS_ENV: test
RUBY_ENV: test
steps:
Expand All @@ -26,4 +27,6 @@ jobs:
run: |
gem install bundler
bundle install --jobs 4 --retry 3
rails db:create
rails db:migrate
bundle exec rspec
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ dev: env
@command -v overmind > /dev/null 2>&1 || { echo >&2 "please install overmind first"; exit 1; }
@yarn run dev

test: env
@echo 'Running rspec tests'
@bundle exec rspec

db-migrate: env
bin/rails db:migrate

Expand Down
5 changes: 5 additions & 0 deletions app/controllers/api/v1/ping_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Api::V1::PingController < ApplicationController
def ping
render status: :ok, body: 'pong'
end
end
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3mXBTuTQTuce/izO1v4GA6xZPNt9wtlU83nGqRHUnQDlURF44/7D9pKoBc9OLr2pW1/oBH8Qk71TQUG5t3XAqLDH4OTbbQy49KCg12EHyhg9lUhPeMbGp17nvKA3YSAhMUYhztkTwU4/+Ox7qJAxbNblmHxj9f+w+BML4pCMQTSUM31m3SQLvsi+6Ab8mY888XWOoBK3qxW58KAgnFbXr1/gyVyEntrI6M+OUtBYx9t17s108KJy72K0+sgU+/ZWvLXDqjigWLv0Y68lziUX0jgiF8MR13LEH/qfJfsLTAti3geSP9m311GsxUYem70DJ2HMXWFM9DNfcNTx4yv8RaW+5RTS03DS6Z+ElZjR6aoOztY4j4Dgae+VMlarVdoxbHf2yc74ljvL2lHn5nvemodT0mYN6/T71aw0+41utodTKhA79DwhBiPJgbKc1AIbaJU54QXBVIdpZ6CF0A4JB4G6PofKbNNEn67RfDXKPprfRV4MsjN9KouiRHCaZOQZn8cfGeqBklXV1BY6dKZUh0wMCXa1ZmoGLBasNdtFVGUeZwh4SJk=--MgSOib34au1Sef7j--VdjSl9KhoDYmTQ/Xedzdug==
5X/tEitXqeVOyzu33tuVoVEGehkgipn/NwYQbfsHZIFt0gK0RyiOl9rs7fGpYiO5GFEjP8cDSMAAkzxUaJEgA5xQPSd/veuANzZpZAp5q1KSf25o2FEs8BqAYxfFqjmstCYnEVoxF4pVuFneSTaBqcS2h9Y9QHNIoqaYEVmI/26D5eWJFAM8ZLwH0PZgs4MeP7XWfriHWKoDNXU6uJ3koZKEYjeMPw5rv1ryhWEeZQ/Lf9mhg66v5vzL6aVC+vztc5QfUC9aBKPNQswwRL4Kex/I5QDS3X4s3LaHvk0toFgW/0HomqHM+GU3zOSyBNPBu2cwHxGjnI4sv0wnYAWzhNxfOOfrw4C9xiKmvnRzUjNU++5+i62wy/VPQu7Vz/nRHEMv38oIvkFVJeM7L43WwaVni15gxQ==--6fVPEZu8ZFUwW4mj--TvOdIbOW4HT1ngsRtW5RLg==
1 change: 1 addition & 0 deletions config/credentials/production.yml.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6g2Lv43gn6ZzFCRN9LK3UwmIDnAcfWzyPxcwD+E1/glHpnzsdfZh3DTdy15fpyEGxM2ZJdAptI0bfDzodv26VcN0RIrzFYyg0/xjTxkV1nskraDDgAzA4WpwO5Y10tHRoAv1GfWLyqOoJ3Ujtxh02YtAxJzUqwEL+JFjD42pBs4cFj96sIQ8Is41dMhRwmIq83+ymiwSXRlP3Rss1Y4Qsl2KlsgPG7Feu75zBTWu6dwJ+cYUAyIh7dqgdv5hYWcEkxkDaKvrdPF9tS6k/qvGke7vWvhv3WDsQyvTx9uUNi01Xz65H1fL88+N3BUskftjjttNT6KVzJKhepSgR9p/3eWvyPi5FeOsVZze4Ux+VEJGkMqAn1la9XHn/k3AAzAL3NyueG9DZQ07ozjhwT6I9FpGHThCliPpPJkFowNzbq7ouvuKg/YhY9UNzwOFiziNgXoIuxyrMIYjvj0D843V2/KNb5FasyDzPe0+Uc9nfNvFY6UFfvV8eGmmTlAMtUCI/R50hxOI6EBLMW2CsaIxOMvrsIz6phwyLWxPTkxNUz23kA1MU1EP4UHA20QgXrUP22pfoAVDzzAR1GNfU7s2Gfp6--lcnmy/1nyjeGdOK1--5xs49y+Sy8waxzSxyFoj9w==
6 changes: 6 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,10 @@
# ]
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
# --- BEGIN PROD DB CRED INITIALIZATION --- #
ENV['DB_PORT'] ||= String(Rails.application.credentials.config[:DB_PORT])
ENV['DB_USER'] ||= Rails.application.credentials.config[:DB_USER]
ENV['DB_PASSWORD'] ||= Rails.application.credentials.config[:DB_PASSWORD]
ENV['DB_NAME'] ||= Rails.application.credentials.config[:DB_NAME]
# --- END PROD DB CRED INITIALIZATION --- #
end
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@

# Defines the root path route ("/")
# root "posts#index"
namespace :api do
draw('api/v1')
end
end
3 changes: 3 additions & 0 deletions config/routes/api/v1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace :v1 do
get :ping, to: 'ping#ping'
end
13 changes: 13 additions & 0 deletions spec/controllers/api/v1/ping_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rails_helper'

describe Api::V1::PingController do
it 'returns a successful response' do
get :ping
expect(response).to be_successful
end

it 'returns pong' do
get :ping
expect(response.body).to eq('pong')
end
end

0 comments on commit 77705b0

Please sign in to comment.