Sha256: e969507e721ef8768d8fcf2c698e06ea7f1612e31b8dd6d86b8d735278cc17af

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

require "cases/helper"
require "models/topic"

module ActiveRecord
  module ConnectionAdapters
    class Mysql2Adapter
      class BindParameterTest < ActiveRecord::Mysql2TestCase
        fixtures :topics

        def test_update_question_marks
          str       = "foo?bar"
          x         = Topic.first
          x.title   = str
          x.content = str
          x.save!
          x.reload
          assert_equal str, x.title
          assert_equal str, x.content
        end

        def test_create_question_marks
          str = "foo?bar"
          x   = Topic.create!(title: str, content: str)
          x.reload
          assert_equal str, x.title
          assert_equal str, x.content
        end

        def test_update_null_bytes
          str       = "foo\0bar"
          x         = Topic.first
          x.title   = str
          x.content = str
          x.save!
          x.reload
          assert_equal str, x.title
          assert_equal str, x.content
        end

        def test_create_null_bytes
          str = "foo\0bar"
          x   = Topic.create!(title: str, content: str)
          x.reload
          assert_equal str, x.title
          assert_equal str, x.content
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ibm_db-5.5.0 test/cases/adapters/mysql2/bind_parameter_test.rb
ibm_db-5.4.1 test/cases/adapters/mysql2/bind_parameter_test.rb
ibm_db-5.4.0 test/cases/adapters/mysql2/bind_parameter_test.rb
ibm_db-5.3.2 test/cases/adapters/mysql2/bind_parameter_test.rb
ibm_db-5.3.1 test/cases/adapters/mysql2/bind_parameter_test.rb
ruby-on-quails-0.1.0 activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb