Sha256: 27eef4e75592e2ecd8bc330d30ada77c3754eaa284d0a305cd15aa3512250632

Contents?: true

Size: 806 Bytes

Versions: 4

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

require "cases/helper"
require "cases/json_shared_test_cases"

class SQLite3JSONTest < ActiveRecord::SQLite3TestCase
  include JSONSharedTestCases

  def setup
    super
    @connection.create_table("json_data_type") do |t|
      t.json "payload", default: {}
      t.json "settings"
    end
  end

  def test_default
    @connection.add_column "json_data_type", "permissions", column_type, default: { "users": "read", "posts": ["read", "write"] }
    klass.reset_column_information

    assert_equal({ "users" => "read", "posts" => ["read", "write"] }, klass.column_defaults["permissions"])
    assert_equal({ "users" => "read", "posts" => ["read", "write"] }, klass.new.permissions)
  end

  private
    def column_type
      :json
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ibm_db-5.5.0-x86-mingw32 test/cases/adapters/sqlite3/json_test.rb
ibm_db-5.4.1-x86-mingw32 test/cases/adapters/sqlite3/json_test.rb
ibm_db-5.4.0-x86-mingw32 test/cases/adapters/sqlite3/json_test.rb
ibm_db-5.3.2-x86-mingw32 test/cases/adapters/sqlite3/json_test.rb