[DRE-commits] [ruby-activerecord-nulldb-adapter] 05/06: Add patch to fix tests for activerecord 4.2

Lucas Moura lucasmoura-guest at moszumanska.debian.org
Sat Mar 5 21:23:45 UTC 2016


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

lucasmoura-guest pushed a commit to branch master
in repository ruby-activerecord-nulldb-adapter.

commit e764d06423242ea866a04de07364909bba0a6d36
Author: Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>
Date:   Sat Mar 5 18:15:10 2016 -0300

    Add patch to fix tests for activerecord 4.2
---
 debian/changelog                                   |  1 +
 .../fix_problem_with_active_record4.2.patch        | 75 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 77 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b901334..efcc713 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ ruby-activerecord-nulldb-adapter (0.3.2-1) UNRELEASED; urgency=medium
   * New upstream release. 
   * Removing patches already applied on new upstream version.
   * Update how package test were executed.
+  * Add patch to fix tests for activerecord 4.2.
 
  -- Sebastien Badia <seb at sebian.fr>  Fri, 10 Apr 2015 10:35:35 +0200
 
diff --git a/debian/patches/fix_problem_with_active_record4.2.patch b/debian/patches/fix_problem_with_active_record4.2.patch
new file mode 100644
index 0000000..30e8409
--- /dev/null
+++ b/debian/patches/fix_problem_with_active_record4.2.patch
@@ -0,0 +1,75 @@
+Description: Fix test for activerecord 4.2
+ This patch fix tests related with the problems related to activerecord 4.2,
+ specially for problems generated by type_cast_from_user,
+ type_cast_from_database.
+
+ These patch was created using two merge requests already opened on the
+ upstream, but not accepted yet. These merge requests are:
+
+ https://github.com/nulldb/nulldb/pull/62
+ https://github.com/nulldb/nulldb/pull/59
+
+Author: Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>
+Last-updated: 2016-03-05
+Forwarded: not-needed 
+Bug: not-needed
+
+Index: ruby-activerecord-nulldb-adapter/lib/active_record/connection_adapters/nulldb_adapter/core.rb
+===================================================================
+--- ruby-activerecord-nulldb-adapter.orig/lib/active_record/connection_adapters/nulldb_adapter/core.rb	2016-03-05 17:45:05.705682049 -0300
++++ ruby-activerecord-nulldb-adapter/lib/active_record/connection_adapters/nulldb_adapter/core.rb	2016-03-05 17:45:40.149680542 -0300
+@@ -129,14 +129,26 @@
+       Kernel.load(schema_path)
+     end
+ 
++    takes_cast_type = defined?(ActiveRecord::Type::Value)
++
+     if table = @tables[table_name]
+       table.columns.map do |col_def|
+-        ActiveRecord::ConnectionAdapters::NullDBAdapter::Column.new(
+-          col_def.name.to_s,
+-          col_def.default,
+-          col_def.type,
+-          col_def.null
+-        )
++        if takes_cast_type
++          ActiveRecord::ConnectionAdapters::NullDBAdapter::Column.new(
++            col_def.name.to_s,
++            col_def.default,
++            lookup_cast_type(col_def.type),
++            col_def.type,
++            col_def.null
++          )
++        else
++          ActiveRecord::ConnectionAdapters::NullDBAdapter::Column.new(
++            col_def.name.to_s,
++            col_def.default,
++            col_def.type,
++            col_def.null
++          )
++        end
+       end
+     else
+       []
+@@ -181,7 +193,7 @@
+ 
+   def delete(statement, name=nil, binds = [])
+     with_entry_point(:delete) do
+-      super(statement, name)
++      super(statement, name).length
+     end
+   end
+ 
+Index: ruby-activerecord-nulldb-adapter/spec/nulldb_spec.rb
+===================================================================
+--- ruby-activerecord-nulldb-adapter.orig/spec/nulldb_spec.rb	2016-03-05 17:45:05.705682049 -0300
++++ ruby-activerecord-nulldb-adapter/spec/nulldb_spec.rb	2016-03-05 17:45:05.701682049 -0300
+@@ -249,7 +249,7 @@
+ 
+   def should_have_column(klass, col_name, col_type)
+     col = klass.columns_hash[col_name.to_s]
+-    expect(col.type).to eq col_type
++    expect(col.sql_type).to eq col_type
+   end
+ 
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..58a49a3
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix_problem_with_active_record4.2.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-activerecord-nulldb-adapter.git



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