rails 4.2: fix initializer specs
refs #CNVS-26056 Change-Id: I6bd8f15c375afc1bbb49d156949c1a92bd1c01d3 Reviewed-on: https://gerrit.instructure.com/70497 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins Product-Review: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
9b5b7ec603
commit
f62911d1d2
|
@ -71,7 +71,9 @@ end
|
|||
module ActiveRecord::Coders
|
||||
class Utf8SafeYAMLColumn < YAMLColumn
|
||||
def load(*args)
|
||||
Utf8Cleaner.recursively_strip_invalid_utf8!(super, true)
|
||||
val = super
|
||||
Utf8Cleaner.recursively_strip_invalid_utf8!(val, true) if val
|
||||
val
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -360,7 +360,7 @@ class ContentZipper
|
|||
#
|
||||
# All other attachments toss on the static attachment pile for
|
||||
# later processing.
|
||||
if entry.content.present?
|
||||
if entry.content.is_a?(Array) && entry.content.present?
|
||||
entry.content.select { |c| c[:section_type] == "rich_text" }.each do |rt|
|
||||
rt[:content].gsub!(StaticAttachment::FILES_REGEX) do |match|
|
||||
att = Attachment.find_by_id(Regexp.last_match(:obj_id))
|
||||
|
|
|
@ -12,7 +12,12 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def column(type)
|
||||
PostgreSQLColumn.new(nil, 1, 1, type)
|
||||
if CANVAS_RAILS4_0
|
||||
PostgreSQLColumn.new(nil, 1, 1, type)
|
||||
else
|
||||
sql_type = @conn.type_to_sql(type)
|
||||
PostgreSQLColumn.new(nil, 1, @conn.lookup_cast_type(sql_type), sql_type)
|
||||
end
|
||||
end
|
||||
|
||||
describe "Infinity and NaN" do
|
||||
|
@ -31,7 +36,7 @@ module ActiveRecord
|
|||
it 'properly quotes Infinity in a datetime column' do
|
||||
infinity = 1.0/0
|
||||
c = column('datetime')
|
||||
assert_equal "'infinity'", @conn.quote(infinity, c)
|
||||
assert_equal (CANVAS_RAILS4_0 ? "'infinity'" : "'Infinity'"), @conn.quote(infinity, c)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ describe 'ruby_version_compat' do
|
|||
}.force_encoding('binary').strip
|
||||
# now actually insert it into an AR column
|
||||
aq = assessment_question_model(bank: AssessmentQuestionBank.create!(context: Course.create!))
|
||||
AssessmentQuestion.where(:id => aq).update_all(:question_data => yaml_blob)
|
||||
ActiveRecord::Base.connection.execute("UPDATE #{AssessmentQuestion.quoted_table_name} SET question_data = '#{yaml_blob}' WHERE id = #{aq.id}")
|
||||
text = aq.reload.question_data['answers'][0]['valid_ascii']
|
||||
expect(text).to eq "text"
|
||||
expect(text.encoding).to eq Encoding::UTF_8
|
||||
|
|
Loading…
Reference in New Issue