diff --git a/test/rails_root/test/unit/user_phone_test.rb b/test/rails_root/test/unit/user_phone_test.rb index 12dbb84..3166661 100644 --- a/test/rails_root/test/unit/user_phone_test.rb +++ b/test/rails_root/test/unit/user_phone_test.rb @@ -10,10 +10,11 @@ def setup def count_of_main_klass_records_not_in_hm_klass(main_klass, hm_klass, hm_relationship_name) foreign_key = main_klass.reflections[hm_relationship_name].instance_variable_get('@active_record').name.foreign_key + raise 'foreign_key is nil' unless foreign_key sql = %Q{ - select count(*) + select count(*) as count_data from #{main_klass.table_name} where users.id NOT IN ( select #{hm_klass.table_name}.#{foreign_key} @@ -22,7 +23,7 @@ def count_of_main_klass_records_not_in_hm_klass(main_klass, hm_klass, hm_relatio } record = main_klass.find_by_sql(sql).first - record['count(*)'] + record['count_data'].to_i end def test_pie_chart_for_user_with_phones_vs_users_without_phones