mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-18 04:39:14 +00:00
Fix cop RedundantPresenceValidationOnBelongs
- presence: true is redundant since Rails 5.0 BUT applies with new default config of belongs_to_required_by_default to true Lots of files with belongs_to_required_by_default = false (backward compatibility) So: deleting this setting implies to adding optional: true on belongs_to relations where there is no explicit check for presence. And also to delete redundant presence: true The implicit becomes the explicit and vice versa - updated toto list
This commit is contained in:
@@ -5,11 +5,11 @@ require 'spec_helper'
|
||||
describe SubscriptionLineItem, model: true do
|
||||
describe "validations" do
|
||||
it "requires a subscription" do
|
||||
expect(subject).to validate_presence_of :subscription
|
||||
expect(subject).to belong_to :subscription
|
||||
end
|
||||
|
||||
it "requires a variant" do
|
||||
expect(subject).to validate_presence_of :variant
|
||||
expect(subject).to belong_to :variant
|
||||
end
|
||||
|
||||
it "requires a integer for quantity" do
|
||||
|
||||
@@ -5,7 +5,7 @@ require 'spec_helper'
|
||||
describe TagRule, type: :model do
|
||||
describe "validations" do
|
||||
it "requires a enterprise" do
|
||||
expect(subject).to validate_presence_of(:enterprise)
|
||||
expect(subject).to belong_to(:enterprise)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user