Merge pull request #4234 from coopdevs/remove-hidden-integrity-check

Remove integrity check for deleted variants in OCs
This commit is contained in:
Pau Pérez Fabregat
2019-09-13 11:27:41 +02:00
committed by GitHub
2 changed files with 0 additions and 26 deletions

View File

@@ -16,10 +16,6 @@ every 1.day, at: '01:00am' do
rake 'ofn:cache:check_products_integrity'
end
every 1.day, at: '12:05am' do
run_file "lib/open_food_network/integrity_checker.rb"
end
every 1.day, at: '2:45am' do
rake 'db2fog:clean' if ENV['S3_BACKUPS_BUCKET']
end

View File

@@ -1,22 +0,0 @@
require 'rspec/rails'
require 'rspec/autorun'
# This spec file is one part of a two-part strategy to maintain data integrity. The first part
# is to proactively protect data integrity using database constraints (not null, foreign keys,
# etc) and ActiveRecord validations. As a backup to those two techniques, and particularly in
# the cases where it's not possible to model an integrity concern with database constraints,
# we can add a reactive integrity test here.
# These tests are run nightly and the results are emailed to the MAILTO address in
# config/schedule.rb if any failures occur.
# Ref: http://pluralsight.com/training/Courses/TableOfContents/database-your-friend
describe "data integrity" do
it "has no deleted variants in order cycles" do
# When a variant is soft deleted, it should be removed from all order cycles
# via Spree::Product#delete or Spree::Variant#delete.
evs = ExchangeVariant.joins(:variant).where('spree_variants.deleted_at IS NOT NULL')
evs.count.should == 0
end
end