diff --git a/app/models/policies.rb b/app/models/policies.rb index 5521d9562..5ec1534f5 100644 --- a/app/models/policies.rb +++ b/app/models/policies.rb @@ -56,8 +56,8 @@ def self.with_attribute(attr) ] def self.prohibited_policy_combination?(policies) - policies.combination(2).any? do |policy1, policy2| - INVALID_POLICY_COMBINATIONS.include?([policy1, policy2].sort_by(&:to_s)) + policies.permutation(2).any? do |policy1, policy2| + INVALID_POLICY_COMBINATIONS.include?([policy1, policy2]) end end end diff --git a/spec/models/policies_spec.rb b/spec/models/policies_spec.rb index 90baa6c32..6a1fb701c 100644 --- a/spec/models/policies_spec.rb +++ b/spec/models/policies_spec.rb @@ -58,12 +58,4 @@ end end end - - describe "::INVALID_POLICY_COMBINATIONS" do - it "contains subarrays that are sorted alphabetically" do - Policies::INVALID_POLICY_COMBINATIONS.each do |subarray| - expect(subarray).to eq(subarray.sort_by(&:to_s)) - end - end - end end