mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Fix RSpecRails/NegationBeValid
Another cop that only supports not_to instead of to_not.
This commit is contained in:
@@ -598,16 +598,6 @@ RSpecRails/InferredSpecType:
|
||||
- 'spec/requests/voucher_adjustments_spec.rb'
|
||||
- 'spec/routing/stripe_spec.rb'
|
||||
|
||||
# Offense count: 14
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: not_to, be_invalid
|
||||
RSpecRails/NegationBeValid:
|
||||
Exclude:
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/spree/product_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
|
||||
@@ -260,18 +260,18 @@ describe Enterprise do
|
||||
|
||||
it "commas at the beginning and end are disallowed" do
|
||||
enterprise = build(:enterprise, preferred_shopfront_taxon_order: ",1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
enterprise = build(:enterprise, preferred_shopfront_taxon_order: "1,2,3,")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
end
|
||||
|
||||
it "any other characters are invalid" do
|
||||
enterprise = build(:enterprise, preferred_shopfront_taxon_order: "a1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
enterprise = build(:enterprise, preferred_shopfront_taxon_order: ".1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
enterprise = build(:enterprise, preferred_shopfront_taxon_order: " 1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
@@ -295,18 +295,18 @@ describe Enterprise do
|
||||
|
||||
it "commas at the beginning and end are disallowed" do
|
||||
enterprise = build(:enterprise, preferred_shopfront_producer_order: ",1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
enterprise = build(:enterprise, preferred_shopfront_producer_order: "1,2,3,")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
end
|
||||
|
||||
it "any other characters are invalid" do
|
||||
enterprise = build(:enterprise, preferred_shopfront_producer_order: "a1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
enterprise = build(:enterprise, preferred_shopfront_producer_order: ".1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
enterprise = build(:enterprise, preferred_shopfront_producer_order: " 1,2,3")
|
||||
expect(enterprise).to be_invalid
|
||||
expect(enterprise).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
@@ -336,7 +336,7 @@ describe Enterprise do
|
||||
|
||||
it "does not validate if URL is invalid and can't be infered" do
|
||||
e = build(:enterprise, white_label_logo_link: 'with spaces')
|
||||
expect(e).to be_invalid
|
||||
expect(e).not_to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -276,7 +276,7 @@ module Spree
|
||||
product.variant_unit_name = nil
|
||||
product.variant_unit_scale = nil
|
||||
|
||||
expect(product).to be_invalid
|
||||
expect(product).not_to be_valid
|
||||
end
|
||||
|
||||
it "requires a unit scale when variant unit is weight" do
|
||||
|
||||
@@ -11,7 +11,7 @@ describe Spree::Variant do
|
||||
context "validations" do
|
||||
it "should validate price is greater than 0" do
|
||||
variant.price = -1
|
||||
expect(variant).to be_invalid
|
||||
expect(variant).not_to be_valid
|
||||
end
|
||||
|
||||
it "should validate price is 0" do
|
||||
@@ -21,7 +21,7 @@ describe Spree::Variant do
|
||||
|
||||
it "should validate unit_value is greater than 0" do
|
||||
variant.unit_value = 0
|
||||
expect(variant).to be_invalid
|
||||
expect(variant).not_to be_valid
|
||||
end
|
||||
|
||||
describe "tax category" do
|
||||
|
||||
Reference in New Issue
Block a user