$ rbenv install 3.3.0 ruby-build: using openssl@1.1 from homebrew ==> Downloading ruby-3.3.0.tar.gz... -> curl -q -fL -o ruby-3.3.0.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 21.0M 100 21.0M 0 0 15.6M 0 0:00:01 0:00:01 --:--:-- 15.6M ==> Installing ruby-3.3.0... ruby-build: using readline from homebrew -> ./configure "--prefix=$HOME/.anyenv/envs/rbenv/versions/3.3.0" --with-openssl-dir=/usr/local/opt/openssl@1.1 --enable-shared --with-readline-dir=/usr/local/opt/readline --with-ext=openssl,psych,+ -> make -j 8 *** Following extensions are not compiled: psych: Could not be configured. It will not be installed. Check /var/folders/vs/21c14yw15wngfp0fn50h2zkw0000gp/T/ruby-build.20240116222001.35871.p9E1v4/ruby-3.3.0/ext/psych/mkmf.log for more details.
BUILD FAILED (macOS 13.6 on x86_64 using ruby-build 20231225-2-g3b79c29)
You can inspect the build directory at /var/folders/vs/21c14yw15wngfp0fn50h2zkw0000gp/T/ruby-build.20240116222001.35871.p9E1v4 See the full build log at /var/folders/vs/21c14yw15wngfp0fn50h2zkw0000gp/T/ruby-build.20240116222001.35871.log
*** Following extensions are not compiled: psych: Could not be configured. It will not be installed. Check /var/folders/vs/21c14yw15wngfp0fn50h2zkw0000gp/T/ruby-build.20240116222001.35871.p9E1v4/ruby-3.3.0/ext/psych/mkmf.log for more details.
$ brew install libyaml Running `brew update --auto-update`... (省略) ==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/manifests/0.2.5 ################################################################################### 100.0% ==> Fetching libyaml ==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:b49e62f014b3e7d85a16 ################################################################################### 100.0% ==> Pouring libyaml--0.2.5.ventura.bottle.tar.gz 🍺 /usr/local/Cellar/libyaml/0.2.5: 10 files, 330KB ==> Running `brew cleanup libyaml`... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
インストールできました。 再度Ruby3.3.0のインストールを行います。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
$ rbenv install 3.3.0 ruby-build: using openssl@1.1 from homebrew ==> Downloading ruby-3.3.0.tar.gz... -> curl -q -fL -o ruby-3.3.0.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 21.0M 100 21.0M 0 0 6361k 0 0:00:03 0:00:03 --:--:-- 6371k ==> Installing ruby-3.3.0... ruby-build: using readline from homebrew ruby-build: using libyaml from homebrew -> ./configure "--prefix=$HOME/.anyenv/envs/rbenv/versions/3.3.0" --with-openssl-dir=/usr/local/opt/openssl@1.1 --enable-shared --with-readline-dir=/usr/local/opt/readline --with-libyaml-dir=/usr/local/opt/libyaml --with-ext=openssl,psych,+ -> make -j 8 -> make install ==> Installed ruby-3.3.0 to /Users/user/.anyenv/envs/rbenv/versions/3.3.0
NOTE: to activate this Ruby version as the new default, run: rbenv global 3.3.0
Runtime options: -f, [--force] # Overwrite files that already exist -p, [--pretend], [--no-pretend] # Run but do not make any changes -q, [--quiet], [--no-quiet] # Suppress status output -s, [--skip], [--no-skip] # Skip files that already exist
Description: Generates a new controller and its views. Pass the controller name, either CamelCased or under_scored, and a list of views as arguments.
To create a controller within a module, specify the controller name as a path like 'parent_module/controller_name'.
This generates a controller class in app/controllers and invokes helper, template engine, assets, and test framework generators.
Example: `bin/rails generate controller CreditCards open debit credit close`
CreditCards controller with URLs like /credit_cards/debit. Controller: app/controllers/credit_cards_controller.rb Test: test/controllers/credit_cards_controller_test.rb Views: app/views/credit_cards/debit.html.erb [...] Helper: app/helpers/credit_cards_helper.rb
host.docker.internalというドメインが初見だったので調べてみると、Docker Desktop for xxで利用できる、コンテナから参照する場合のhostを指すドメインだということです。わたしの環境はDocker Desktop for Macを利用しているので利用できるはずです。
$ git diff Gemfile diff --git a/api/Gemfile b/api/Gemfile --- a/api/Gemfile +++ b/api/Gemfile @@ -76,6 +76,7 @@ group :test do gem "capybara" gem "selenium-webdriver" gem "webdrivers" + gem "committee-rails" end
1 2 3 4 5 6 7 8 9 10 11
$ docker-compose run --rm api ./bin/bundle install Using devise-i18n 1.10.2 Using devise_token_auth 1.2.1 Installing openapi_parser 0.15.0 Installing json_schema 0.21.0 Fetching committee 4.4.0 Installing committee 4.4.0 Fetching committee-rails 0.6.1 Installing committee-rails 0.6.1 Bundle complete! 29 Gemfile dependencies, 114 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed.
RSpec.describe "API::Auth::RegistrationsController", type: :request do describe "POST /api/v1/auth" do it "returns 200" do post "/api/v1/auth", params: { email: "example@example.com" } assert_response_schema_confirm(200) end
it "returns 422" do post "/api/v1/auth", params: { password: "password" } assert_response_schema_confirm(422) end end end
specの実行
では実行します。
1 2 3 4 5 6 7 8 9 10
$ docker-compose run --rm api ./bin/rspec spec/api/v1/auth/registrations_controller_spec.rb
(省略)
Failures: 1) API::Auth::RegistrationsController POST /api/v1/auth return 200 Failure/Error: <p><%= link_to t('.confirm_account_link'), confirmation_url(@resource, {confirmation_token: @token, config: message['client-config'].to_s, redirect_url: message['redirect-url']}).html_safe %></p> ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
$ docker-compose run --rm api ./bin/rspec spec/api/v1/auth/registrations_controller_spec.rb
(省略)
API::Auth::RegistrationsController POST /api/v1/auth [DEPRECATION] Committee: please set query_hash_key = rack.request.query_hash because we'll change default value in next major version. [DEPRECATION] Committee: please set parse_response_by_content_type = false because we'll change default value in next major version.