Sha256: 7cb417242f201688d499447a70f1e75ebea54228e9ebb52498ee139ab0cbefbd
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require "#{File.dirname(__FILE__)}/../../helper" Scrooge::Test.prepare! class OptimizationsAssociationsMacroTest < ActiveSupport::TestCase test "should be able to flag any associations instantiated from a record" do @user = MysqlUser.find(:first) @user.host assert_equal MysqlUser.scrooge_callsite( @user.callsite_signature ).associations, Set[:host] end test "should only flag preloadable associations" do Scrooge::Callsite.any_instance.expects(:association!).once @user = MysqlUser.find(:first) @user.host assert_equal MysqlUser.scrooge_callsite( @user.callsite_signature ).associations, Set.new end test "should be able to identify all preloadable associations for a given Model" do assert_equal MysqlUser.preloadable_associations, [:host] assert_equal MysqlHost.preloadable_associations, [] assert_equal MysqlColumnPrivilege.preloadable_associations, [:mysql_user] assert_equal MysqlTablePrivilege.preloadable_associations, [:mysql_user, :column_privilege] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
methodmissing-scrooge-3.0.0 | test/optimizations/associations/macro_test.rb |