[DRE-commits] [ruby-protected-attributes] 01/02: attribute_sanitization_test: avoid random failures

Antonio Terceiro terceiro at moszumanska.debian.org
Fri Aug 25 16:05:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch patch-queue/master
in repository ruby-protected-attributes.

commit 2fb59d93040462f9d1a1252c79a95e75801e3b82
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Mon Aug 29 15:26:19 2016 -0300

    attribute_sanitization_test: avoid random failures
    
    Because test/test_helper.rb sets the tests to run on random order, that
    missing call to `super` will cause tests to crash with the following
    exception, depending on which order the test classes get loaded.
    
    ```
    ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: UNIQUE
    constraint failed: people.id: INSERT INTO "people" ("id", "first_name", "gender", "comments", "best_friend_id", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?)
    ```
    
    On my tests, this seems to happen more or less 6% of the time (i.e. 3
    out of 50 runs). With this change, I was able to make 50 runs without a
    single failure.
    
    Gbp-Pq: Name fix-ramdom-failures.patch
---
 test/attribute_sanitization_test.rb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/attribute_sanitization_test.rb b/test/attribute_sanitization_test.rb
index 6ebb9ab..92f808b 100644
--- a/test/attribute_sanitization_test.rb
+++ b/test/attribute_sanitization_test.rb
@@ -16,6 +16,7 @@ require 'models/wolf'
 
 module MassAssignmentTestHelpers
   def teardown
+    super
     ActiveRecord::Base.send(:descendants).each do |klass|
       begin
         klass.delete_all

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-protected-attributes.git



More information about the Pkg-ruby-extras-commits mailing list