Sha256: e2fe699dc0d66575ca65aab0caa44605c23d242d932517978ab3bb818d660b80

Contents?: true

Size: 657 Bytes

Versions: 8

Compression:

Stored size: 657 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
ibm_db-5.2.0 test/cases/types_test.rb
ibm_db-5.1.0 test/cases/types_test.rb
ibm_db-5.0.5 test/cases/types_test.rb
ibm_db-5.0.4 test/cases/types_test.rb
ibm_db-5.0.3 test/cases/types_test.rb
ibm_db-5.0.2 test/cases/types_test.rb
ibm_db-4.0.0-x86-mingw32 test/cases/types_test.rb
ibm_db-4.0.0 test/cases/types_test.rb