Skip to content

Commit

Permalink
fix preview test
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Jan 31, 2024
1 parent 264cbe7 commit 43081da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/components/events/table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def additional_info(event)

def show_additional_info?(event)
return true if event.has_attribute?(:user_id) && event.user == current_user
return true if event.additional.has_attribute?("actor_gid") && event.additional.actor_gid == current_user.to_gid
return true if event.additional.has_attribute?("actor_gid") && event.additional.actor_gid == current_user&.to_gid

false
end
Expand Down
9 changes: 9 additions & 0 deletions test/components/preview_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
require "test_helper"

class PreviewTest < ComponentTest
attr_reader :current_user

def view_context
super.tap do |view_context|
test_case = self
view_context.singleton_class.define_method(:current_user) { test_case.current_user }
end
end

test "all previews render" do
capture_io { Rails.application.load_seed }

Expand Down

0 comments on commit 43081da

Please sign in to comment.