Sha256: 06c163bbe25722c82af0db3f5ef4dc09624e129a053230897bb14a4201c320cb

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

require "cases/helper"

module ActiveRecord
  module ConnectionAdapters
    class TypesTest < ActiveRecord::TestCase
      def test_attributes_which_are_invalid_for_database_can_still_be_reassigned
        type_which_cannot_go_to_the_database = Type::Value.new
        def type_which_cannot_go_to_the_database.serialize(*)
          raise
        end
        klass = Class.new(ActiveRecord::Base) do
          self.table_name = "posts"
          attribute :foo, type_which_cannot_go_to_the_database
        end
        model = klass.new

        model.foo = "foo"
        model.foo = "bar"

        assert_equal "bar", model.foo
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ibm_db-5.5.0-x86-mingw32 test/cases/types_test.rb
ibm_db-5.4.1-x86-mingw32 test/cases/types_test.rb
ibm_db-5.4.0-x86-mingw32 test/cases/types_test.rb
ibm_db-5.3.2-x86-mingw32 test/cases/types_test.rb