Sha256: cf28a59c7508ea76e265b166281ec0513135666a2caf6ab06387d25a23508494
Contents?: true
Size: 851 Bytes
Versions: 3
Compression:
Stored size: 851 Bytes
Contents
# frozen_string_literal: true require "test_helper" class SingleTableInheritanceTest < ActiveSupport::TestCase def test_superclass_find__caches_superclass_record animal = Animal.create assert_no_queries do assert_equal animal, Animal.find(animal.id) end end def test_superclass_find__caches_subclass_record dog = Dog.create assert_no_queries do assert_equal dog, Animal.find(dog.id) end end def test_subclass_find__caches_subclass_record dog = Dog.create dog_id = dog.id assert_no_queries do newdog = Dog.find(dog_id) assert_equal dog, newdog end end def test_subclass_find__doesnt_find_superclass_record animal = Animal.create assert_queries(:any) do assert_raises ActiveRecord::RecordNotFound do Dog.find(animal.id) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems