rails 5: fix initializer specs
in particular, completely dump the quoting monkeypatch and specs - we no longer know what column it's quoting for at this level, and the float problems have long been fixed in rails proper Change-Id: I9bbd214e6c866fcae1222f368f544f4805aac1cf Reviewed-on: https://gerrit.instructure.com/103830 Tested-by: Jenkins Reviewed-by: Simon Williams <simon@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
d2d7b81fee
commit
87375fc3dd
|
@ -177,6 +177,7 @@ module PostgreSQLAdapterExtensions
|
|||
end
|
||||
end
|
||||
|
||||
if CANVAS_RAILS4_2
|
||||
# Force things with (approximate) integer representations (Floats,
|
||||
# BigDecimals, Times, etc.) into those representations. Raise
|
||||
# ActiveRecord::StatementInvalid for any other non-integer things.
|
||||
|
@ -203,6 +204,7 @@ module PostgreSQLAdapterExtensions
|
|||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def extension_installed?(extension)
|
||||
@extensions ||= {}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require File.expand_path('../spec_helper', File.dirname( __FILE__ ))
|
||||
|
||||
if CANVAS_RAILS4_2
|
||||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
if defined?(PostgreSQLAdapter)
|
||||
|
@ -90,3 +91,4 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -242,7 +242,8 @@ module ActiveRecord
|
|||
describe "union" do
|
||||
shared_examples_for "query creation" do
|
||||
it "should include conditions after the union inside of the subquery" do
|
||||
wheres = base.active.where(id:99).union(User.where(id:1)).where_values
|
||||
scope = base.active.where(id:99).union(User.where(id:1))
|
||||
wheres = CANVAS_RAILS4_2 ? scope.where_values : scope.where_clause.send(:predicates)
|
||||
expect(wheres.count).to eq 1
|
||||
sql_before_union, sql_after_union = wheres.first.split("UNION ALL")
|
||||
expect(sql_before_union.include?('"id" = 99')).to be_falsey
|
||||
|
@ -250,7 +251,8 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
it "should include conditions prior to the union outside of the subquery" do
|
||||
wheres = base.active.union(User.where(id:1)).where(id:99).where_values
|
||||
scope = base.active.union(User.where(id:1)).where(id:99)
|
||||
wheres = CANVAS_RAILS4_2 ? scope.where_values : scope.where_clause.send(:predicates)
|
||||
expect(wheres.count).to eq 2
|
||||
union_where = wheres.detect{|w| w.is_a?(String) && w.include?("UNION ALL")}
|
||||
expect(union_where.include?('"id" = 99')).to be_falsey
|
||||
|
|
Loading…
Reference in New Issue