1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

system testでdeliver_later実行時にSerializationError

Last updated at Posted at 2019-02-08

RailsのactionMailerでdeliver_laterする際、ブラウザから操作した場合は問題ないのにsystem test時に下記のエラーが発生。

ActiveJob::SerializationError: Unsupported argument type: Time

rspecかcapybaraかと思ったら、activeJobのバグと、ActionMailerに渡しているmockの書き方が原因だった。

myMailer.myMethod(params).deliver_later

paramsはAPIで取得するJSONをparseしたハッシュのため、テストの場合はmockにしていたが、TimeWithZone型をそのまま突っ込んでいた。
これをstringにすることで解決。

参考

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?