Tag Archives: RSpec

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.

Continue reading RSpec: Test Helper Method using current_user function