Sha256: f3b8de376a9ca427891e6e0ee002f6f77864d8228ededb1d74b0e8a77ccc4e7e
Contents?: true
Size: 758 Bytes
Versions: 16
Compression:
Stored size: 758 Bytes
Contents
require "cases/helper" require 'models/owner' require 'models/pet' class ReloadModelsTest < ActiveRecord::TestCase fixtures :pets, :owners def test_has_one_with_reload pet = Pet.find_by_name('parrot') pet.owner = Owner.find_by_name('ashley') # Reload the class Owner, simulating auto-reloading of model classes in a # development environment. Note that meanwhile the class Pet is not # reloaded, simulating a class that is present in a plugin. Object.class_eval { remove_const :Owner } Kernel.load(File.expand_path(File.join(File.dirname(__FILE__), "../models/owner.rb"))) pet = Pet.find_by_name('parrot') pet.owner = Owner.find_by_name('ashley') assert_equal pet.owner, Owner.find_by_name('ashley') end end
Version data entries
16 entries across 16 versions & 1 rubygems