aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2/json_test.rb
blob: d311ffb7039e0deea57ebac898a3fdbcfba4917e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require "cases/helper"
require "cases/json_shared_test_cases"

if ActiveRecord::Base.connection.supports_json?
  class Mysql2JSONTest < ActiveRecord::Mysql2TestCase
    include JSONSharedTestCases
    self.use_transactional_tests = false

    def setup
      @connection = ActiveRecord::Base.connection
      begin
        @connection.create_table("json_data_type") do |t|
          t.json "payload"
          t.json "settings"
        end
      end
    end

    def teardown
      @connection.drop_table :json_data_type, if_exists: true
      JsonDataType.reset_column_information
    end

    private
      def column_type
        :json
      end
  end
end