I’ve written cover story 2, “[Practical] Kotlin”, in WEB+DB PRESS Vol. 109. My parts are chapter 2, 3 and 5.
Tag Archives: [:ja]テスト[:en]Test[:]
(日本語) JUnit 5 ユーザーズガイド を読む 1
RSpec: Test Helper Method using current_user function
I’ll introduce the way to test rails helper code that uses current_user
method provided by device gem.
Environment
- Ruby 2.2.2
- Rails 4.1.8
- RSpec 3.1.0
Test Target
The function we are going to test is below. It compare the return value of current_user
method and user_id
given as argument, and check the argument user_id
is of current login user or not.