How to disable current_user inside spec spec?

I want to make sure that this link is displayed only when both user values ​​are set:

- if current_user.dms.present? and current_user.dms_id.present?
  = link_to "Import Items", "#"

How to disable this variable current_user?

+4
source share
2 answers

Are you sure you are adding helpers for both views and controllers?

RSpec.configure do |config|
  config.include Devise::TestHelpers, :type => :controller
  config.include Devise::TestHelpers, :type => :view
end
+2
source

If you use the Devise Gem for your current_user, have you tried using the Test Assistants (Devise :: TestHelpers)? They allow you to sign and sign in and out of the user and, therefore, access the current_user entry in your controller and view the specifications.

Deviki Wiki : Wiki TestHelpers

+1

All Articles