Sha256: 9e1f67c9a09d35d5cf78a8373c2c024a533bad3dd3ad119669514c60d622bf31

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

# Copyright 2021 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

# frozen_string_literal: true

require "test_helper"

module ActiveRecord
  module Type
    class DateTest < SpannerAdapter::TestCase
      include SpannerAdapter::Types::TestHelper

      def test_convert_to_sql_type
        assert_equal "JSON", connection.type_to_sql(:json)
      end

      def test_set_json
        return if ENV["SPANNER_EMULATOR_HOST"]

        expected_hash = {"key"=>"value", "array_key"=>%w[value1 value2]}
        record = TestTypeModel.new details: {key: "value", array_key: %w[value1 value2]}

        assert_equal expected_hash, record.details

        record.save!
        record.reload
        assert_equal expected_hash, record.details
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-spanner-adapter-1.0.1 acceptance/cases/type/json_test.rb
activerecord-spanner-adapter-1.0.0 acceptance/cases/type/json_test.rb
activerecord-spanner-adapter-0.7.0 acceptance/cases/type/json_test.rb
activerecord-spanner-adapter-0.6.0 acceptance/cases/type/json_test.rb