From 2de24224177c9b39214785e9f1e382c9f49f7502 Mon Sep 17 00:00:00 2001 From: Ynda Jas Date: Tue, 13 Aug 2024 17:21:13 +0100 Subject: [PATCH] Removed unused method This was used by the `UserApplicationPermissionPolicy`, which was deleted in 2a78b5c --- app/models/user_application_permission.rb | 4 --- .../user_application_permission_test.rb | 31 ------------------- 2 files changed, 35 deletions(-) diff --git a/app/models/user_application_permission.rb b/app/models/user_application_permission.rb index a6f491802..2a077d7be 100644 --- a/app/models/user_application_permission.rb +++ b/app/models/user_application_permission.rb @@ -8,10 +8,6 @@ class UserApplicationPermission < ApplicationRecord before_validation :assign_application_id - def self.for(user:, supported_permission:, application: nil) - new(user:, supported_permission:, application: application || supported_permission.application) - end - private # application_id is duplicated across supported_permissions and user_application_permissions diff --git a/test/models/user_application_permission_test.rb b/test/models/user_application_permission_test.rb index 5e19be475..10b763382 100644 --- a/test/models/user_application_permission_test.rb +++ b/test/models/user_application_permission_test.rb @@ -1,37 +1,6 @@ require "test_helper" class UserApplicationPermissionTest < ActiveSupport::TestCase - context ".for" do - setup do - @user = build(:user) - @supported_permission = build(:supported_permission) - @application = build(:application, supported_permissions: [@supported_permission]) - end - - context "for a user, supported permission, and application" do - setup { @result = UserApplicationPermission.for(user: @user, supported_permission: @supported_permission, application: @application) } - - should "return a UserApplicationPermission with the given associations" do - assert @result.instance_of?(UserApplicationPermission) - assert_equal @user, @result.user - assert_equal @supported_permission, @result.supported_permission - assert_equal @application, @result.application - end - - should "not persist the UserApplicationPermission" do - assert_not @result.persisted? - end - end - - context "without an application" do - should "infer the application from the supported permission" do - result = UserApplicationPermission.for(user: @user, supported_permission: @supported_permission) - - assert_equal @application, result.application - end - end - end - context "validations" do setup do @user = create(:user)