Sha256: 739091e65b4540e4e573333de5a14337271e8f75564a04d7bb9051860093df81

Contents?: true

Size: 688 Bytes

Versions: 6

Compression:

Stored size: 688 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

6 entries across 6 versions & 2 rubygems

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