Rails5からテストケースにてHTTP methodsで利用する場合、キーワード引数が必須になった。
before
post url, hoge: 'foo'
after
post url, params: { hoge: 'foo' }
Rails4からRails5へ以降する際に、既存のspecファイルが大量にある場合、手動で行うとなかなか以降がスムーズに行きづらいです。
機械的に一括変換をする。
機械的に一括変換をするgemがあります。
spec/controller/test_controller.rb
get :index
search: 'bayleef',
format: :json
Gemfile
+ gem 'rails5-spec-converter'
$ bundle install --path vendor/bundle
$ bundle exec rails5-spec-converter
spec/controller/test_controller.rb
get :index
params: {
search: 'bayleef'
},
format: :json