Merge pull request #7712 from guidoDutra/1861-enable-shopfront-sorting-by-producer

Enable sorting by producer in shopfront
This commit is contained in:
Andy Brett
2021-07-06 09:27:42 -07:00
committed by GitHub
14 changed files with 176 additions and 40 deletions

View File

@@ -188,6 +188,41 @@ describe Enterprise do
expect(enterprise).to be_invalid
end
end
describe "preferred_shopfront_producer_order" do
it "empty strings are valid" do
enterprise = build(:enterprise, preferred_shopfront_producer_order: "")
expect(enterprise).to be_valid
end
it "a single integer is valid" do
enterprise = build(:enterprise, preferred_shopfront_producer_order: "11")
expect(enterprise).to be_valid
end
it "comma delimited integers are valid" do
enterprise = build(:enterprise, preferred_shopfront_producer_order: "1,2,3")
expect(enterprise).to be_valid
enterprise = build(:enterprise, preferred_shopfront_producer_order: "1,22,333")
expect(enterprise).to be_valid
end
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
enterprise = build(:enterprise, preferred_shopfront_producer_order: "1,2,3,")
expect(enterprise).to be_invalid
end
it "any other characters are invalid" do
enterprise = build(:enterprise, preferred_shopfront_producer_order: "a1,2,3")
expect(enterprise).to be_invalid
enterprise = build(:enterprise, preferred_shopfront_producer_order: ".1,2,3")
expect(enterprise).to be_invalid
enterprise = build(:enterprise, preferred_shopfront_producer_order: " 1,2,3")
expect(enterprise).to be_invalid
end
end
end
describe "callbacks" do