[rubygem-activerecord/f20] Fix SQLite tests

Josef Stribny jstribny at fedoraproject.org
Wed Feb 26 15:01:03 UTC 2014


commit 2f22365f51ad0a123791a5ee96be0f84af365972
Author: Josef Stribny <jstribny at redhat.com>
Date:   Wed Feb 26 15:45:51 2014 +0100

    Fix SQLite tests

 rubygem-activerecord-sqlite-3.2.8-test.patch |   20 ++++++++++++++++++++
 rubygem-activerecord.spec                    |    8 +++++++-
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/rubygem-activerecord-sqlite-3.2.8-test.patch b/rubygem-activerecord-sqlite-3.2.8-test.patch
new file mode 100644
index 0000000..e48988d
--- /dev/null
+++ b/rubygem-activerecord-sqlite-3.2.8-test.patch
@@ -0,0 +1,20 @@
+diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
+index e5ad08b..19fa850 100644
+--- a/lib/active_record/connection_adapters/sqlite3_adapter.rb
++++ b/lib/active_record/connection_adapters/sqlite3_adapter.rb
+@@ -595,7 +595,11 @@ def sqlite_version
+ 
+         def translate_exception(exception, message)
+           case exception.message
+-          when /column(s)? .* (is|are) not unique/
++          # SQLite 3.8.2 returns a newly formatted error message:
++          #   UNIQUE constraint failed: *table_name*.*column_name*
++          # Older versions of SQLite return:
++          #   column *column_name* is not unique
++          when /column(s)? .* (is|are) not unique/, /UNIQUE constraint failed: .*/
+             RecordNotUnique.new(message, exception)
+           else
+             super
+-- 
+1.8.5.5
+
diff --git a/rubygem-activerecord.spec b/rubygem-activerecord.spec
index f6eb508..c90a5d4 100644
--- a/rubygem-activerecord.spec
+++ b/rubygem-activerecord.spec
@@ -17,6 +17,9 @@ Source0: http://rubygems.org/downloads/activerecord-%{version}.gem
 Source1: activerecord-%{version}-tests.tgz
 # Fix for CVE-2014-0080: PostgreSQL array data injection vulnerability
 Patch0: rubygem-activerecord-4.0.3-CVE-2014-0080-PostgreSQL.patch
+# Fix SQlite 3.2.8 tests
+# https://github.com/rails/rails/pull/13291
+Patch1: rubygem-activerecord-sqlite-3.2.8-test.patch
 Requires: ruby(release)
 Requires: ruby(rubygems)
 Requires: rubygem(activesupport) = %{version}
@@ -60,7 +63,9 @@ Documentation for %{name}
 %gem_install -n %{SOURCE0}
 
 pushd .%{gem_instdir}
+tar xzvf %{SOURCE1}
 %patch0 -p1
+%patch1 -p1
 popd
 
 %build
@@ -71,7 +76,6 @@ cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}
 
 %check
 pushd .%{gem_instdir}
-tar xzvf %{SOURCE1}
 
 # load_path is not available, remove its require.
 sed -i '1,2d' test/cases/helper.rb
@@ -96,6 +100,7 @@ popd
 %{gem_libdir}
 %doc %{gem_instdir}/MIT-LICENSE
 %exclude %{gem_cache}
+%exclude %{gem_instdir}/test
 %{gem_spec}
 
 %files doc
@@ -108,6 +113,7 @@ popd
 %changelog
 * Wed Feb 26 2014 Josef Stribny <jstribny at redhat.com> - 1:4.0.0-2
 - Fix CVE-2014-0080: PostgreSQL array data injection vulnerability
+- Fix SQLite tests
 
 * Thu Aug 01 2013 Josef Stribny <jstribny at redhat.com> - 1:4.0.0-1
 - Update to ActiveRecord 4.0.0.


More information about the scm-commits mailing list