5
5

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.

expect change を複数データ同時にTESTしたいときに

Posted at

expect change を複数データ同時にTESTしたいときなどがあります。
そんな時には以下のようにするとできます。(例はあまり適切ではありません...)

expect{ execute }.to change{ [User.find_by(id: 1).coin, User.find_by(id: 1).skill] }.from([100, 0]).to([0, 1])

Ref.

5
5
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?