Skip to content

How do we use Pundit helper methods inside of view components test .rb files? #1871

Answered by niladrix719
niladrix719 asked this question in Q&A
Discussion options

You must be logged in to vote

@reeganviljoen well i was not able to use pundit methods inside of view component , but it got solved after i added this two lines :

include Pundit::Authorization
include Devise::Controllers::Helpers

module TableRow
  class TableRowComponent < ViewComponent::Base
    include Pundit::Authorization
    include Devise::Controllers::Helpers

    def initialize(assignment, current_user, group, deadline_time)
      super
      @assignment = assignment
      @current_user = current_user
      @deadline_minute = deadline_time[:minute]
      @deadline_day = deadline_time[:day]
      @deadline_year = deadline_time[:year]
      @deadline_second = deadline_time[:second]
      @deadline_hour = deadlin…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by niladrix719
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants