LoginSignup
1
0

More than 1 year has passed since last update.

【RSpec】APIテストでformat: :json

Posted at

環境

Ruby 3.0.2
Rails 6.1.4.1

routes.rbformat: :json指定しておくと、
APIテストの方で省略できる。

config/routes.rb
Rails.application.routes.draw do
  namespace :api, format: 'json' do
    resources :users
  end
end
spec.rb
get api_v1_abc_path(format: :json)

#↓

get '/api/v1/abc'

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0