diff --git a/.github/workflows/restful-api.yml b/.github/workflows/ruby-on-rails--restful-api.yml similarity index 86% rename from .github/workflows/restful-api.yml rename to .github/workflows/ruby-on-rails--restful-api.yml index 9ec00879..3d708ab9 100644 --- a/.github/workflows/restful-api.yml +++ b/.github/workflows/ruby-on-rails--restful-api.yml @@ -5,7 +5,7 @@ # This workflow will install a prebuilt Ruby version, install dependencies, and # run tests and linters. -name: RESTful API +name: Ruby on Rails - RESTful API on: push: @@ -21,9 +21,9 @@ on: - ruby-on-rails/restful-api/Rakefile - ruby-on-rails/restful-api/.rubocop.yml - ruby-on-rails/restful-api/.rubocop_todo.yml - # - ruby-on-rails/restful-api/Steepfile + - ruby-on-rails/restful-api/Steepfile - ruby-on-rails/restful-api/**/*.rb - # - ruby-on-rails/restful-api/**/*.rbs + - ruby-on-rails/restful-api/**/*.rbs - ruby-on-rails/restful-api/**/*.rake - ruby-on-rails/restful-api/**/*.yml pull_request: @@ -37,9 +37,9 @@ on: - ruby-on-rails/restful-api/Rakefile - ruby-on-rails/restful-api/.rubocop.yml - ruby-on-rails/restful-api/.rubocop_todo.yml - # - ruby-on-rails/restful-api/Steepfile + - ruby-on-rails/restful-api/Steepfile - ruby-on-rails/restful-api/**/*.rb - # - ruby-on-rails/restful-api/**/*.rbs + - ruby-on-rails/restful-api/**/*.rbs - ruby-on-rails/restful-api/**/*.rake - ruby-on-rails/restful-api/**/*.yml @@ -53,7 +53,7 @@ jobs: outputs: ruby-changes: ${{ steps.change-detection.outputs.ruby }} rubocop-changes: ${{ steps.change-detection.outputs.rubocop}} - # steep-changes: ${{ steps.change-detection.outputs.steep}} + steep-changes: ${{ steps.change-detection.outputs.steep}} steps: - uses: actions/checkout@v6 - name: Change Detection @@ -148,19 +148,19 @@ jobs: - name: RuboCop working-directory: ./ruby-on-rails/restful-api run: bundle exec rubocop - # steep: - # timeout-minutes: 10 - # runs-on: ubuntu-latest - # needs: change-detection - # if: needs.change-detection.outputs.steep-changes == 'true' - # steps: - # - uses: actions/checkout@v6 - # - uses: ./.github/actions/setup-ruby-on-rails - # with: - # working-directory: ./ruby-on-rails/restful-api - # job-name: steep - # - name: Steep - # working-directory: ./ruby-on-rails/restful-api - # run: | - # bundle exec rbs-inline --output sig/generated/ . - # bundle exec steep check + steep: + timeout-minutes: 10 + runs-on: ubuntu-latest + needs: change-detection + if: needs.change-detection.outputs.steep-changes == 'true' + steps: + - uses: actions/checkout@v6 + - uses: ./.github/actions/setup-ruby-on-rails + with: + working-directory: ./ruby-on-rails/restful-api + job-name: steep + - name: Steep + working-directory: ./ruby-on-rails/restful-api + run: | + bundle exec rbs-inline --output sig/generated/ . + bundle exec steep check diff --git a/ruby-on-rails/restful-api/Gemfile b/ruby-on-rails/restful-api/Gemfile index ec2cb2d5..54094020 100644 --- a/ruby-on-rails/restful-api/Gemfile +++ b/ruby-on-rails/restful-api/Gemfile @@ -33,8 +33,6 @@ gem 'will_paginate', '~> 4.0.1' # environmental variables gem 'dotenv-rails', '~> 3.2.0' -gem 'nokogiri', '~> 1.19.3' - gem 'net-smtp', '~> 0.5.0' # The Observer pattern provides a simple mechanism for one object to inform a set of interested third-party objects when its state changes. @@ -43,9 +41,6 @@ gem 'observer', '~> 0.1.2' # Data structure, similar to a Hash, that allows the definition of arbitrary attributes with their accompanying values gem 'ostruct', '~> 0.6.3' -# A foreign function interface (FFI) is a mechanism by which a program written in one programming language can call routines or make use of services written or compiled in another one -gem 'ffi', '~> 1.17.4' - group :development, :test do # Debug tool used with binding.irb. Explicit require avoids eager loading `debug/prelude` # which interferes with the Docker boot process. @@ -62,6 +57,9 @@ group :development do gem 'rubocop-performance', '~> 1.26.0', require: false gem 'rubocop-rails', '~> 2.34.3', require: false gem 'rubocop-rspec', '~> 3.9.0', require: false + # Typechecking + gem 'rbs-inline', '~> 0.13.0', require: false + gem 'steep', '~> 1.10.0', require: false end group :test do diff --git a/ruby-on-rails/restful-api/Gemfile.lock b/ruby-on-rails/restful-api/Gemfile.lock index 4a296778..b14a0cae 100644 --- a/ruby-on-rails/restful-api/Gemfile.lock +++ b/ruby-on-rails/restful-api/Gemfile.lock @@ -94,6 +94,7 @@ GEM concurrent-ruby (1.3.6) connection_pool (3.0.2) crass (1.0.6) + csv (3.3.5) database_cleaner (2.1.0) database_cleaner-active_record (>= 2, < 3) database_cleaner-active_record (2.2.2) @@ -119,8 +120,8 @@ GEM railties (>= 6.1.0) faker (3.8.0) i18n (>= 1.8.11, < 2) - ffi (1.17.4) ffi (1.17.4-x86_64-linux-gnu) + fileutils (1.8.0) globalid (1.3.0) activesupport (>= 6.1) i18n (1.14.8) @@ -137,6 +138,10 @@ GEM base64 language_server-protocol (3.17.0.5) lint_roller (1.1.0) + listen (3.10.0) + logger + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) logger (1.7.0) loofah (2.25.1) crass (~> 1.0.2) @@ -153,6 +158,7 @@ GEM drb (~> 2.0) prism (~> 1.5) msgpack (1.8.0) + mutex_m (0.3.0) mysql2 (0.5.7) bigdecimal net-imap (0.6.4) @@ -223,6 +229,15 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.4.2) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rbs (3.10.4) + logger + tsort + rbs-inline (0.13.0) + prism (>= 0.29) + rbs (>= 3.8.0) rdoc (7.2.0) erb psych (>= 4.0.0) @@ -278,7 +293,27 @@ GEM securerandom (0.4.1) shoulda-matchers (7.0.1) activesupport (>= 7.1) + steep (1.10.0) + activesupport (>= 5.1) + concurrent-ruby (>= 1.1.10) + csv (>= 3.0.9) + fileutils (>= 1.1.0) + json (>= 2.1.0) + language_server-protocol (>= 3.17.0.4, < 4.0) + listen (~> 3.0) + logger (>= 1.3.0) + mutex_m (>= 0.3.0) + parser (>= 3.1) + rainbow (>= 2.2.2, < 4.0) + rbs (~> 3.9) + securerandom (>= 0.1) + strscan (>= 1.0.0) + terminal-table (>= 2, < 5) + uri (>= 0.12.0) stringio (3.2.0) + strscan (3.1.8) + terminal-table (4.0.0) + unicode-display_width (>= 1.1.1, < 4) thor (1.5.0) timeout (0.6.1) tsort (0.2.0) @@ -309,21 +344,21 @@ DEPENDENCIES dotenv-rails (~> 3.2.0) factory_bot_rails (~> 6.5.1) faker (~> 3.8.0) - ffi (~> 1.17.4) jwt (~> 3.1.2) mysql2 (~> 0.5.7) net-smtp (~> 0.5.0) - nokogiri (~> 1.19.3) observer (~> 0.1.2) ostruct (~> 0.6.3) puma (~> 8.0.1) rails (~> 8.1.3) + rbs-inline (~> 0.13.0) rspec-rails (~> 8.0.4) rubocop (~> 1.86.1) rubocop-performance (~> 1.26.0) rubocop-rails (~> 2.34.3) rubocop-rspec (~> 3.9.0) shoulda-matchers (~> 7.0.1) + steep (~> 1.10.0) tzinfo-data will_paginate (~> 4.0.1) @@ -353,6 +388,7 @@ CHECKSUMS concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d + csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f database_cleaner (2.1.0) sha256=1dcba26e3b1576da692fc6bac10136a4744da5bcc293d248aae19640c65d89cd database_cleaner-active_record (2.2.2) sha256=88296b9f3088c31f7c0d4fcec10f68e4b71c96698043916de59b04debec10388 database_cleaner-core (2.0.1) sha256=8646574c32162e59ed7b5258a97a208d3c44551b854e510994f24683865d846c @@ -367,8 +403,8 @@ CHECKSUMS factory_bot (6.5.6) sha256=12beb373214dccc086a7a63763d6718c49769d5606f0501e0a4442676917e077 factory_bot_rails (6.5.1) sha256=d3cc4851eae4dea8a665ec4a4516895045e710554d2b5ac9e68b94d351bc6d68 faker (3.8.0) sha256=c147b308df73a90f27a4fc84f18d4c22ef0ad9c2a64b2b61c86fd0ca71753efc - ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d + fileutils (1.8.0) sha256=8c6b1df54e2540bdb2f39258f08af78853aa70bad52b4d394bbc6424593c6e02 globalid (1.3.0) sha256=05c639ad6eb4594522a0b07983022f04aa7254626ab69445a0e493aa3786ff11 i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5 io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc @@ -378,6 +414,7 @@ CHECKSUMS jwt (3.1.2) sha256=af6991f19a6bb4060d618d9add7a66f0eeb005ac0bc017cd01f63b42e122d535 language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 + listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2 logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 loofah (2.25.1) sha256=d436c73dbd0c1147b16c4a41db097942d217303e1f7728704b37e4df9f6d2e04 mail (2.9.0) sha256=6fa6673ecd71c60c2d996260f9ee3dd387d4673b8169b502134659ece6d34941 @@ -385,6 +422,7 @@ CHECKSUMS mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1 msgpack (1.8.0) sha256=e64ce0212000d016809f5048b48eb3a65ffb169db22238fb4b72472fecb2d732 + mutex_m (0.3.0) sha256=cfcb04ac16b69c4813777022fdceda24e9f798e48092a2b817eb4c0a782b0751 mysql2 (0.5.7) sha256=ba09ede515a0ae8a7192040a1b778c0fb0f025fa5877e9be895cd325fa5e9d7b net-imap (0.6.4) sha256=9a5598c67a3022c284d98430ef1d4948e7dbdb62596f61081ea8ca933270a02b net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3 @@ -412,6 +450,10 @@ CHECKSUMS railties (8.1.3) sha256=913eb0e0cb520aac687ffd74916bd726d48fa21f47833c6292576ef6a286de22 rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 + rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe + rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e + rbs (3.10.4) sha256=b17d7c4be4bb31a11a3b529830f0aa206a807ca42f2e7921a3027dfc6b7e5ce8 + rbs-inline (0.13.0) sha256=aba6e48c2d1b75276e8557376164f4b4ba96dd0204e779a5cee2af442bd30442 rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192 regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835 @@ -428,7 +470,10 @@ CHECKSUMS ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 shoulda-matchers (7.0.1) sha256=b4bfd8744c10e0a36c8ac1a687f921ee7e25ed529e50488d61b79a8688749c77 + steep (1.10.0) sha256=1b295b55f9aaff1b8d3ee42453ee55bc2a1078fda0268f288edb2dc014f4d7d1 stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1 + strscan (3.1.8) sha256=aae2db611a225559f21ffbb71765c9a4e60fd262534a9ea84f4f11c7f32f679e + terminal-table (4.0.0) sha256=f504793203f8251b2ea7c7068333053f0beeea26093ec9962e62ea79f94301d2 thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73 timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f diff --git a/ruby-on-rails/restful-api/Steepfile b/ruby-on-rails/restful-api/Steepfile new file mode 100644 index 00000000..d43294ff --- /dev/null +++ b/ruby-on-rails/restful-api/Steepfile @@ -0,0 +1,11 @@ +D = Steep::Diagnostic + +target :app do + check "app" + check "spec" + signature "sig" + + library "net-smtp" + + configure_code_diagnostics(D::Ruby.default) +end diff --git a/ruby-on-rails/restful-api/app/auth/authenticate_user.rb b/ruby-on-rails/restful-api/app/auth/authenticate_user.rb index a6943db3..5837fa75 100644 --- a/ruby-on-rails/restful-api/app/auth/authenticate_user.rb +++ b/ruby-on-rails/restful-api/app/auth/authenticate_user.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class AuthenticateUser def initialize(email, password) @email = email diff --git a/ruby-on-rails/restful-api/app/auth/authorize_api_request.rb b/ruby-on-rails/restful-api/app/auth/authorize_api_request.rb index 3582cbe3..5c2bc3a4 100644 --- a/ruby-on-rails/restful-api/app/auth/authorize_api_request.rb +++ b/ruby-on-rails/restful-api/app/auth/authorize_api_request.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class AuthorizeApiRequest def initialize(headers = {}) @headers = headers diff --git a/ruby-on-rails/restful-api/app/channels/application_cable/channel.rb b/ruby-on-rails/restful-api/app/channels/application_cable/channel.rb index d6726972..3376ec25 100644 --- a/ruby-on-rails/restful-api/app/channels/application_cable/channel.rb +++ b/ruby-on-rails/restful-api/app/channels/application_cable/channel.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/ruby-on-rails/restful-api/app/channels/application_cable/connection.rb b/ruby-on-rails/restful-api/app/channels/application_cable/connection.rb index 0ff5442f..feda2e8b 100644 --- a/ruby-on-rails/restful-api/app/channels/application_cable/connection.rb +++ b/ruby-on-rails/restful-api/app/channels/application_cable/connection.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/ruby-on-rails/restful-api/app/controllers/application_controller.rb b/ruby-on-rails/restful-api/app/controllers/application_controller.rb index 9467a2ac..da8e2adb 100644 --- a/ruby-on-rails/restful-api/app/controllers/application_controller.rb +++ b/ruby-on-rails/restful-api/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class ApplicationController < ActionController::API include Response include ExceptionHandler diff --git a/ruby-on-rails/restful-api/app/controllers/authentication_controller.rb b/ruby-on-rails/restful-api/app/controllers/authentication_controller.rb index 1c572e69..c041c7c0 100644 --- a/ruby-on-rails/restful-api/app/controllers/authentication_controller.rb +++ b/ruby-on-rails/restful-api/app/controllers/authentication_controller.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class AuthenticationController < ApplicationController skip_before_action :authorize_request, only: :authenticate diff --git a/ruby-on-rails/restful-api/app/controllers/concerns/exception_handler.rb b/ruby-on-rails/restful-api/app/controllers/concerns/exception_handler.rb index 79cf4e50..1afec114 100644 --- a/ruby-on-rails/restful-api/app/controllers/concerns/exception_handler.rb +++ b/ruby-on-rails/restful-api/app/controllers/concerns/exception_handler.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled module ExceptionHandler extend ActiveSupport::Concern diff --git a/ruby-on-rails/restful-api/app/controllers/concerns/response.rb b/ruby-on-rails/restful-api/app/controllers/concerns/response.rb index cfb0caa4..5679d147 100644 --- a/ruby-on-rails/restful-api/app/controllers/concerns/response.rb +++ b/ruby-on-rails/restful-api/app/controllers/concerns/response.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled module Response def json_response(object, status = :ok) render json: object, status: status diff --git a/ruby-on-rails/restful-api/app/controllers/users_controller.rb b/ruby-on-rails/restful-api/app/controllers/users_controller.rb index 8fd3e176..adebbfa9 100644 --- a/ruby-on-rails/restful-api/app/controllers/users_controller.rb +++ b/ruby-on-rails/restful-api/app/controllers/users_controller.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class UsersController < ApplicationController skip_before_action :authorize_request, only: :create diff --git a/ruby-on-rails/restful-api/app/controllers/v1/items_controller.rb b/ruby-on-rails/restful-api/app/controllers/v1/items_controller.rb index 4df64e01..78985e60 100644 --- a/ruby-on-rails/restful-api/app/controllers/v1/items_controller.rb +++ b/ruby-on-rails/restful-api/app/controllers/v1/items_controller.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class V1::ItemsController < ApplicationController before_action :set_todo before_action :set_todo_item, only: %i(show update destroy) diff --git a/ruby-on-rails/restful-api/app/controllers/v1/todos_controller.rb b/ruby-on-rails/restful-api/app/controllers/v1/todos_controller.rb index 425d0aa7..bad5ff89 100644 --- a/ruby-on-rails/restful-api/app/controllers/v1/todos_controller.rb +++ b/ruby-on-rails/restful-api/app/controllers/v1/todos_controller.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class V1::TodosController < ApplicationController before_action :set_todo, only: %i(show update destroy) diff --git a/ruby-on-rails/restful-api/app/controllers/v2/todos_controller.rb b/ruby-on-rails/restful-api/app/controllers/v2/todos_controller.rb index d30b9e1f..52713219 100644 --- a/ruby-on-rails/restful-api/app/controllers/v2/todos_controller.rb +++ b/ruby-on-rails/restful-api/app/controllers/v2/todos_controller.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class V2::TodosController < ApplicationController def index # a dummy response diff --git a/ruby-on-rails/restful-api/app/jobs/application_job.rb b/ruby-on-rails/restful-api/app/jobs/application_job.rb index d394c3d1..8c2a02f9 100644 --- a/ruby-on-rails/restful-api/app/jobs/application_job.rb +++ b/ruby-on-rails/restful-api/app/jobs/application_job.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked diff --git a/ruby-on-rails/restful-api/app/lib/api_version.rb b/ruby-on-rails/restful-api/app/lib/api_version.rb index 01b3e254..f82866c9 100644 --- a/ruby-on-rails/restful-api/app/lib/api_version.rb +++ b/ruby-on-rails/restful-api/app/lib/api_version.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class ApiVersion attr_reader :version, :default diff --git a/ruby-on-rails/restful-api/app/lib/concerns/exception_handler.rb b/ruby-on-rails/restful-api/app/lib/concerns/exception_handler.rb index 7eb38b8e..ef79b4e5 100644 --- a/ruby-on-rails/restful-api/app/lib/concerns/exception_handler.rb +++ b/ruby-on-rails/restful-api/app/lib/concerns/exception_handler.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled module ExceptionHandler extend ActiveSupport::Concern diff --git a/ruby-on-rails/restful-api/app/lib/json_web_token.rb b/ruby-on-rails/restful-api/app/lib/json_web_token.rb index 6a4d63a1..3264f38b 100644 --- a/ruby-on-rails/restful-api/app/lib/json_web_token.rb +++ b/ruby-on-rails/restful-api/app/lib/json_web_token.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class JsonWebToken # secret to encode and decode token HMAC_SECRET = Rails.application.credentials.secret_key_base diff --git a/ruby-on-rails/restful-api/app/lib/message.rb b/ruby-on-rails/restful-api/app/lib/message.rb index e47526c2..63653e18 100644 --- a/ruby-on-rails/restful-api/app/lib/message.rb +++ b/ruby-on-rails/restful-api/app/lib/message.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class Message def self.not_found(record = 'record') "Sorry, #{record} not found." diff --git a/ruby-on-rails/restful-api/app/mailers/application_mailer.rb b/ruby-on-rails/restful-api/app/mailers/application_mailer.rb index 286b2239..fd2c7103 100644 --- a/ruby-on-rails/restful-api/app/mailers/application_mailer.rb +++ b/ruby-on-rails/restful-api/app/mailers/application_mailer.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' diff --git a/ruby-on-rails/restful-api/app/models/application_record.rb b/ruby-on-rails/restful-api/app/models/application_record.rb index 10a4cba8..59a2c323 100644 --- a/ruby-on-rails/restful-api/app/models/application_record.rb +++ b/ruby-on-rails/restful-api/app/models/application_record.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/ruby-on-rails/restful-api/app/models/item.rb b/ruby-on-rails/restful-api/app/models/item.rb index 3c718bc7..3015cce5 100644 --- a/ruby-on-rails/restful-api/app/models/item.rb +++ b/ruby-on-rails/restful-api/app/models/item.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class Item < ApplicationRecord belongs_to :todo diff --git a/ruby-on-rails/restful-api/app/models/todo.rb b/ruby-on-rails/restful-api/app/models/todo.rb index d1c6048a..b7a79df1 100644 --- a/ruby-on-rails/restful-api/app/models/todo.rb +++ b/ruby-on-rails/restful-api/app/models/todo.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class Todo < ApplicationRecord has_many :items, dependent: :destroy belongs_to :user diff --git a/ruby-on-rails/restful-api/app/models/user.rb b/ruby-on-rails/restful-api/app/models/user.rb index 1f43d42e..f863c1d0 100644 --- a/ruby-on-rails/restful-api/app/models/user.rb +++ b/ruby-on-rails/restful-api/app/models/user.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class User < ApplicationRecord # encrypt password has_secure_password diff --git a/ruby-on-rails/restful-api/app/serializers/todo_serializer.rb b/ruby-on-rails/restful-api/app/serializers/todo_serializer.rb index ea8f839c..a581f583 100644 --- a/ruby-on-rails/restful-api/app/serializers/todo_serializer.rb +++ b/ruby-on-rails/restful-api/app/serializers/todo_serializer.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled class TodoSerializer < ActiveModel::Serializer # attributes to be serialized attributes :id, :title, :user_id, :created_at, :updated_at diff --git a/ruby-on-rails/restful-api/sig/generated/app/auth/authenticate_user.rbs b/ruby-on-rails/restful-api/sig/generated/app/auth/authenticate_user.rbs new file mode 100644 index 00000000..36e6c7d7 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/auth/authenticate_user.rbs @@ -0,0 +1,18 @@ +# Generated from app/auth/authenticate_user.rb with RBS::Inline + +# rbs_inline: enabled +class AuthenticateUser + def initialize: (untyped email, untyped password) -> untyped + + # Service entry point + def call: () -> untyped + + private + + attr_reader email: untyped + + attr_reader password: untyped + + # verify user credentials + def user: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/auth/authorize_api_request.rbs b/ruby-on-rails/restful-api/sig/generated/app/auth/authorize_api_request.rbs new file mode 100644 index 00000000..42390b66 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/auth/authorize_api_request.rbs @@ -0,0 +1,21 @@ +# Generated from app/auth/authorize_api_request.rb with RBS::Inline + +# rbs_inline: enabled +class AuthorizeApiRequest + def initialize: (?untyped headers) -> untyped + + # Service entry point - return valid user object + def call: () -> untyped + + private + + attr_reader headers: untyped + + def user: () -> untyped + + # decode authentication token + def decoded_auth_token: () -> untyped + + # check for token in `Authorization` header + def http_auth_header: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/channels/application_cable/channel.rbs b/ruby-on-rails/restful-api/sig/generated/app/channels/application_cable/channel.rbs new file mode 100644 index 00000000..e8941ece --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/channels/application_cable/channel.rbs @@ -0,0 +1,7 @@ +# Generated from app/channels/application_cable/channel.rb with RBS::Inline + +# rbs_inline: enabled +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/channels/application_cable/connection.rbs b/ruby-on-rails/restful-api/sig/generated/app/channels/application_cable/connection.rbs new file mode 100644 index 00000000..a8d379ac --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/channels/application_cable/connection.rbs @@ -0,0 +1,7 @@ +# Generated from app/channels/application_cable/connection.rb with RBS::Inline + +# rbs_inline: enabled +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/application_controller.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/application_controller.rbs new file mode 100644 index 00000000..ea429441 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/application_controller.rbs @@ -0,0 +1,15 @@ +# Generated from app/controllers/application_controller.rb with RBS::Inline + +# rbs_inline: enabled +class ApplicationController < ActionController::API + include Response + + include ExceptionHandler + + attr_reader current_user: untyped + + private + + # Check for valid request token and return user + def authorize_request: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/authentication_controller.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/authentication_controller.rbs new file mode 100644 index 00000000..7851124d --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/authentication_controller.rbs @@ -0,0 +1,11 @@ +# Generated from app/controllers/authentication_controller.rb with RBS::Inline + +# rbs_inline: enabled +class AuthenticationController < ApplicationController + # return auth token once user is authenticated + def authenticate: () -> untyped + + private + + def auth_params: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/concerns/exception_handler.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/concerns/exception_handler.rbs new file mode 100644 index 00000000..bafd8f33 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/concerns/exception_handler.rbs @@ -0,0 +1,27 @@ +# Generated from app/controllers/concerns/exception_handler.rb with RBS::Inline + +# rbs_inline: enabled +module ExceptionHandler + extend ActiveSupport::Concern + + # Define custom error subclasses - rescue catches `StandardErrors` + class AuthenticationError < StandardError + end + + class MissingToken < StandardError + end + + class InvalidToken < StandardError + end + + private + + # JSON response with message; Status code 422 - unprocessable entity + def four_twenty_two: (untyped error) -> untyped + + # JSON response with message; Status code 401 - Unauthorized + def unauthorized_request: (untyped error) -> untyped + + # JSON response with message; Status code 404 - NotFound + def four_zero_four: (untyped error) -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/concerns/response.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/concerns/response.rbs new file mode 100644 index 00000000..de4df6e6 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/concerns/response.rbs @@ -0,0 +1,6 @@ +# Generated from app/controllers/concerns/response.rb with RBS::Inline + +# rbs_inline: enabled +module Response + def json_response: (untyped object, ?untyped status) -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/users_controller.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/users_controller.rbs new file mode 100644 index 00000000..71688d51 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/users_controller.rbs @@ -0,0 +1,12 @@ +# Generated from app/controllers/users_controller.rb with RBS::Inline + +# rbs_inline: enabled +class UsersController < ApplicationController + # POST /signup + # return authenticated token upon signup + def create: () -> untyped + + private + + def user_params: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/v1/items_controller.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/v1/items_controller.rbs new file mode 100644 index 00000000..7d02a670 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/v1/items_controller.rbs @@ -0,0 +1,27 @@ +# Generated from app/controllers/v1/items_controller.rb with RBS::Inline + +# rbs_inline: enabled +class V1::ItemsController < ApplicationController + # GET /todos/:todo_id/items + def index: () -> untyped + + # GET /todos/:todo_id/items/:id + def show: () -> untyped + + # POST /todos/:todo_id/items + def create: () -> untyped + + # PUT /todos/:todo_id/items/:id + def update: () -> untyped + + # DELETE /todos/:todo_id/items/:id + def destroy: () -> untyped + + private + + def set_todo: () -> untyped + + def set_todo_item: () -> untyped + + def item_params: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/v1/todos_controller.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/v1/todos_controller.rbs new file mode 100644 index 00000000..93d3b834 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/v1/todos_controller.rbs @@ -0,0 +1,25 @@ +# Generated from app/controllers/v1/todos_controller.rb with RBS::Inline + +# rbs_inline: enabled +class V1::TodosController < ApplicationController + # GET /todos + def index: () -> untyped + + # GET /todos/:id + def show: () -> untyped + + # POST /todos + def create: () -> untyped + + # PUT /todos/:id + def update: () -> untyped + + # DELETE /todos/:id + def destroy: () -> untyped + + private + + def set_todo: () -> untyped + + def todo_params: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/controllers/v2/todos_controller.rbs b/ruby-on-rails/restful-api/sig/generated/app/controllers/v2/todos_controller.rbs new file mode 100644 index 00000000..71d25331 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/controllers/v2/todos_controller.rbs @@ -0,0 +1,6 @@ +# Generated from app/controllers/v2/todos_controller.rb with RBS::Inline + +# rbs_inline: enabled +class V2::TodosController < ApplicationController + def index: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/jobs/application_job.rbs b/ruby-on-rails/restful-api/sig/generated/app/jobs/application_job.rbs new file mode 100644 index 00000000..74568208 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/jobs/application_job.rbs @@ -0,0 +1,5 @@ +# Generated from app/jobs/application_job.rb with RBS::Inline + +# rbs_inline: enabled +class ApplicationJob < ActiveJob::Base +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/lib/api_version.rbs b/ruby-on-rails/restful-api/sig/generated/app/lib/api_version.rbs new file mode 100644 index 00000000..a3b15f94 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/lib/api_version.rbs @@ -0,0 +1,17 @@ +# Generated from app/lib/api_version.rb with RBS::Inline + +# rbs_inline: enabled +class ApiVersion + attr_reader version: untyped + + attr_reader default: untyped + + def initialize: (untyped version, ?untyped default) -> untyped + + # check whether version is specified or is default + def matches?: (untyped request) -> untyped + + private + + def check_headers: (untyped headers) -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/lib/concerns/exception_handler.rbs b/ruby-on-rails/restful-api/sig/generated/app/lib/concerns/exception_handler.rbs new file mode 100644 index 00000000..e81cf086 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/lib/concerns/exception_handler.rbs @@ -0,0 +1,24 @@ +# Generated from app/lib/concerns/exception_handler.rb with RBS::Inline + +# rbs_inline: enabled +module ExceptionHandler + extend ActiveSupport::Concern + + # Define custom error subclasses - rescue catches `StandardErrors` + class AuthenticationError < StandardError + end + + class MissingToken < StandardError + end + + class InvalidToken < StandardError + end + + private + + # JSON response with message; Status code 422 - unprocessable entity + def four_twenty_two: (untyped error) -> untyped + + # JSON response with message; Status code 401 - Unauthorized + def unauthorized_request: (untyped error) -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/lib/json_web_token.rbs b/ruby-on-rails/restful-api/sig/generated/app/lib/json_web_token.rbs new file mode 100644 index 00000000..682a6729 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/lib/json_web_token.rbs @@ -0,0 +1,11 @@ +# Generated from app/lib/json_web_token.rb with RBS::Inline + +# rbs_inline: enabled +class JsonWebToken + # secret to encode and decode token + HMAC_SECRET: untyped + + def self.encode: (untyped payload, ?untyped exp) -> untyped + + def self.decode: (untyped token) -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/lib/message.rbs b/ruby-on-rails/restful-api/sig/generated/app/lib/message.rbs new file mode 100644 index 00000000..f44d4d5f --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/lib/message.rbs @@ -0,0 +1,20 @@ +# Generated from app/lib/message.rb with RBS::Inline + +# rbs_inline: enabled +class Message + def self.not_found: (?untyped record) -> untyped + + def self.invalid_credentials: () -> untyped + + def self.invalid_token: () -> untyped + + def self.missing_token: () -> untyped + + def self.unauthorized: () -> untyped + + def self.account_created: () -> untyped + + def self.account_not_created: () -> untyped + + def self.expired_token: () -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/mailers/application_mailer.rbs b/ruby-on-rails/restful-api/sig/generated/app/mailers/application_mailer.rbs new file mode 100644 index 00000000..40a166e7 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/mailers/application_mailer.rbs @@ -0,0 +1,5 @@ +# Generated from app/mailers/application_mailer.rb with RBS::Inline + +# rbs_inline: enabled +class ApplicationMailer < ActionMailer::Base +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/models/application_record.rbs b/ruby-on-rails/restful-api/sig/generated/app/models/application_record.rbs new file mode 100644 index 00000000..6e8c5365 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/models/application_record.rbs @@ -0,0 +1,5 @@ +# Generated from app/models/application_record.rb with RBS::Inline + +# rbs_inline: enabled +class ApplicationRecord < ActiveRecord::Base +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/models/item.rbs b/ruby-on-rails/restful-api/sig/generated/app/models/item.rbs new file mode 100644 index 00000000..fe4c362a --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/models/item.rbs @@ -0,0 +1,5 @@ +# Generated from app/models/item.rb with RBS::Inline + +# rbs_inline: enabled +class Item < ApplicationRecord +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/models/todo.rbs b/ruby-on-rails/restful-api/sig/generated/app/models/todo.rbs new file mode 100644 index 00000000..b5c24265 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/models/todo.rbs @@ -0,0 +1,5 @@ +# Generated from app/models/todo.rb with RBS::Inline + +# rbs_inline: enabled +class Todo < ApplicationRecord +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/models/user.rbs b/ruby-on-rails/restful-api/sig/generated/app/models/user.rbs new file mode 100644 index 00000000..433d4e47 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/models/user.rbs @@ -0,0 +1,5 @@ +# Generated from app/models/user.rb with RBS::Inline + +# rbs_inline: enabled +class User < ApplicationRecord +end diff --git a/ruby-on-rails/restful-api/sig/generated/app/serializers/todo_serializer.rbs b/ruby-on-rails/restful-api/sig/generated/app/serializers/todo_serializer.rbs new file mode 100644 index 00000000..5e2acb66 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/app/serializers/todo_serializer.rbs @@ -0,0 +1,5 @@ +# Generated from app/serializers/todo_serializer.rb with RBS::Inline + +# rbs_inline: enabled +class TodoSerializer < ActiveModel::Serializer +end diff --git a/ruby-on-rails/restful-api/sig/generated/spec/auth/authenticate_user_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/auth/authenticate_user_spec.rbs new file mode 100644 index 00000000..af4967a9 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/auth/authenticate_user_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/auth/authenticate_user_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/auth/authorize_api_request_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/auth/authorize_api_request_spec.rbs new file mode 100644 index 00000000..da659c50 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/auth/authorize_api_request_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/auth/authorize_api_request_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/controllers/application_controller_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/controllers/application_controller_spec.rbs new file mode 100644 index 00000000..05966158 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/controllers/application_controller_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/controllers/application_controller_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/factories/items.rbs b/ruby-on-rails/restful-api/sig/generated/spec/factories/items.rbs new file mode 100644 index 00000000..0e6c39f5 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/factories/items.rbs @@ -0,0 +1,2 @@ +# Generated from spec/factories/items.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/factories/todos.rbs b/ruby-on-rails/restful-api/sig/generated/spec/factories/todos.rbs new file mode 100644 index 00000000..c62c67ea --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/factories/todos.rbs @@ -0,0 +1,2 @@ +# Generated from spec/factories/todos.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/factories/user.rbs b/ruby-on-rails/restful-api/sig/generated/spec/factories/user.rbs new file mode 100644 index 00000000..22e0ea7a --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/factories/user.rbs @@ -0,0 +1,2 @@ +# Generated from spec/factories/user.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/models/item_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/models/item_spec.rbs new file mode 100644 index 00000000..d58b6381 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/models/item_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/models/item_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/models/todo_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/models/todo_spec.rbs new file mode 100644 index 00000000..0a39eb8d --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/models/todo_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/models/todo_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/models/user_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/models/user_spec.rbs new file mode 100644 index 00000000..f63e81a3 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/models/user_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/models/user_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/rails_helper.rbs b/ruby-on-rails/restful-api/sig/generated/spec/rails_helper.rbs new file mode 100644 index 00000000..47c0332c --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/rails_helper.rbs @@ -0,0 +1,2 @@ +# Generated from spec/rails_helper.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/requests/authentication_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/requests/authentication_spec.rbs new file mode 100644 index 00000000..5f48d9b6 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/requests/authentication_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/requests/authentication_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/requests/items_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/requests/items_spec.rbs new file mode 100644 index 00000000..d1f6e934 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/requests/items_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/requests/items_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/requests/todos_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/requests/todos_spec.rbs new file mode 100644 index 00000000..787eac37 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/requests/todos_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/requests/todos_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/requests/users_spec.rbs b/ruby-on-rails/restful-api/sig/generated/spec/requests/users_spec.rbs new file mode 100644 index 00000000..e83f64b2 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/requests/users_spec.rbs @@ -0,0 +1,2 @@ +# Generated from spec/requests/users_spec.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/spec_helper.rbs b/ruby-on-rails/restful-api/sig/generated/spec/spec_helper.rbs new file mode 100644 index 00000000..5af4f2a5 --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/spec_helper.rbs @@ -0,0 +1,2 @@ +# Generated from spec/spec_helper.rb with RBS::Inline + diff --git a/ruby-on-rails/restful-api/sig/generated/spec/support/controller_spec_helper.rbs b/ruby-on-rails/restful-api/sig/generated/spec/support/controller_spec_helper.rbs new file mode 100644 index 00000000..3649112f --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/support/controller_spec_helper.rbs @@ -0,0 +1,16 @@ +# Generated from spec/support/controller_spec_helper.rb with RBS::Inline + +# rbs_inline: enabled +module ControllerSpecHelper + # generate tokens from user id + def token_generator: (untyped user_id) -> untyped + + # generate expired tokens from user id + def expired_token_generator: (untyped user_id) -> untyped + + # return valid headers + def valid_headers: (?untyped version) -> untyped + + # return invalid headers + def invalid_headers: (?untyped version) -> untyped +end diff --git a/ruby-on-rails/restful-api/sig/generated/spec/support/request_spec_helper.rbs b/ruby-on-rails/restful-api/sig/generated/spec/support/request_spec_helper.rbs new file mode 100644 index 00000000..1a669dee --- /dev/null +++ b/ruby-on-rails/restful-api/sig/generated/spec/support/request_spec_helper.rbs @@ -0,0 +1,7 @@ +# Generated from spec/support/request_spec_helper.rb with RBS::Inline + +# rbs_inline: enabled +module RequestSpecHelper + # Parse JSON response to ruby hash + def json: () -> untyped +end diff --git a/ruby-on-rails/restful-api/spec/auth/authenticate_user_spec.rb b/ruby-on-rails/restful-api/spec/auth/authenticate_user_spec.rb index 5c74f6bf..590fb922 100644 --- a/ruby-on-rails/restful-api/spec/auth/authenticate_user_spec.rb +++ b/ruby-on-rails/restful-api/spec/auth/authenticate_user_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' RSpec.describe AuthenticateUser do diff --git a/ruby-on-rails/restful-api/spec/auth/authorize_api_request_spec.rb b/ruby-on-rails/restful-api/spec/auth/authorize_api_request_spec.rb index 3eccaa73..4d838577 100644 --- a/ruby-on-rails/restful-api/spec/auth/authorize_api_request_spec.rb +++ b/ruby-on-rails/restful-api/spec/auth/authorize_api_request_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' RSpec.describe AuthorizeApiRequest do diff --git a/ruby-on-rails/restful-api/spec/controllers/application_controller_spec.rb b/ruby-on-rails/restful-api/spec/controllers/application_controller_spec.rb index d31dda1f..c2e6e398 100644 --- a/ruby-on-rails/restful-api/spec/controllers/application_controller_spec.rb +++ b/ruby-on-rails/restful-api/spec/controllers/application_controller_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' RSpec.describe ApplicationController, type: :controller do diff --git a/ruby-on-rails/restful-api/spec/factories/items.rb b/ruby-on-rails/restful-api/spec/factories/items.rb index 41ef2a6c..5da3c750 100644 --- a/ruby-on-rails/restful-api/spec/factories/items.rb +++ b/ruby-on-rails/restful-api/spec/factories/items.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled FactoryBot.define do factory :item do name { Faker::Lorem.word } diff --git a/ruby-on-rails/restful-api/spec/factories/todos.rb b/ruby-on-rails/restful-api/spec/factories/todos.rb index 4d595381..2948729a 100644 --- a/ruby-on-rails/restful-api/spec/factories/todos.rb +++ b/ruby-on-rails/restful-api/spec/factories/todos.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled FactoryBot.define do factory :todo do title { Faker::Lorem.word } diff --git a/ruby-on-rails/restful-api/spec/factories/user.rb b/ruby-on-rails/restful-api/spec/factories/user.rb index 6d11300b..769ad68c 100644 --- a/ruby-on-rails/restful-api/spec/factories/user.rb +++ b/ruby-on-rails/restful-api/spec/factories/user.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled FactoryBot.define do factory :user do name { Faker::Name.name } diff --git a/ruby-on-rails/restful-api/spec/models/item_spec.rb b/ruby-on-rails/restful-api/spec/models/item_spec.rb index 41338d2a..672d4428 100644 --- a/ruby-on-rails/restful-api/spec/models/item_spec.rb +++ b/ruby-on-rails/restful-api/spec/models/item_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' # Test suite for the Item model diff --git a/ruby-on-rails/restful-api/spec/models/todo_spec.rb b/ruby-on-rails/restful-api/spec/models/todo_spec.rb index 1d56b1f4..1a0ef2cf 100644 --- a/ruby-on-rails/restful-api/spec/models/todo_spec.rb +++ b/ruby-on-rails/restful-api/spec/models/todo_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' # Test suite for the Todo model diff --git a/ruby-on-rails/restful-api/spec/models/user_spec.rb b/ruby-on-rails/restful-api/spec/models/user_spec.rb index cd44a29a..aabf1b4e 100644 --- a/ruby-on-rails/restful-api/spec/models/user_spec.rb +++ b/ruby-on-rails/restful-api/spec/models/user_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' # Test suite for User model diff --git a/ruby-on-rails/restful-api/spec/rails_helper.rb b/ruby-on-rails/restful-api/spec/rails_helper.rb index b962b7c4..43615779 100644 --- a/ruby-on-rails/restful-api/spec/rails_helper.rb +++ b/ruby-on-rails/restful-api/spec/rails_helper.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' diff --git a/ruby-on-rails/restful-api/spec/requests/authentication_spec.rb b/ruby-on-rails/restful-api/spec/requests/authentication_spec.rb index 1fe3e3f0..a81f1aa2 100644 --- a/ruby-on-rails/restful-api/spec/requests/authentication_spec.rb +++ b/ruby-on-rails/restful-api/spec/requests/authentication_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' RSpec.describe 'Authentication', type: :request do diff --git a/ruby-on-rails/restful-api/spec/requests/items_spec.rb b/ruby-on-rails/restful-api/spec/requests/items_spec.rb index 60cbcb69..178c4e12 100644 --- a/ruby-on-rails/restful-api/spec/requests/items_spec.rb +++ b/ruby-on-rails/restful-api/spec/requests/items_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' RSpec.describe 'Items API' do diff --git a/ruby-on-rails/restful-api/spec/requests/todos_spec.rb b/ruby-on-rails/restful-api/spec/requests/todos_spec.rb index 62e2bcaf..f153da2d 100644 --- a/ruby-on-rails/restful-api/spec/requests/todos_spec.rb +++ b/ruby-on-rails/restful-api/spec/requests/todos_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' RSpec.describe 'Todos API', type: :request do diff --git a/ruby-on-rails/restful-api/spec/requests/users_spec.rb b/ruby-on-rails/restful-api/spec/requests/users_spec.rb index 7cf844b2..57828462 100644 --- a/ruby-on-rails/restful-api/spec/requests/users_spec.rb +++ b/ruby-on-rails/restful-api/spec/requests/users_spec.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled require 'rails_helper' RSpec.describe 'Users API', type: :request do diff --git a/ruby-on-rails/restful-api/spec/spec_helper.rb b/ruby-on-rails/restful-api/spec/spec_helper.rb index ce33d66d..09c4d07d 100644 --- a/ruby-on-rails/restful-api/spec/spec_helper.rb +++ b/ruby-on-rails/restful-api/spec/spec_helper.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause diff --git a/ruby-on-rails/restful-api/spec/support/controller_spec_helper.rb b/ruby-on-rails/restful-api/spec/support/controller_spec_helper.rb index a1be9de5..51aafc8d 100644 --- a/ruby-on-rails/restful-api/spec/support/controller_spec_helper.rb +++ b/ruby-on-rails/restful-api/spec/support/controller_spec_helper.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled module ControllerSpecHelper # generate tokens from user id def token_generator(user_id) diff --git a/ruby-on-rails/restful-api/spec/support/request_spec_helper.rb b/ruby-on-rails/restful-api/spec/support/request_spec_helper.rb index 4c2b8ad0..d573d8ee 100644 --- a/ruby-on-rails/restful-api/spec/support/request_spec_helper.rb +++ b/ruby-on-rails/restful-api/spec/support/request_spec_helper.rb @@ -1,3 +1,4 @@ +# rbs_inline: enabled module RequestSpecHelper # Parse JSON response to ruby hash def json