spec/support/tables_helper.rb in facemock-0.0.6 vs spec/support/tables_helper.rb in facemock-0.0.7
- old
+ new
@@ -1,5 +1,17 @@
module TableHelper
+ def remove_dynamically_defined_all_method
+ klasses = [Facemock::Database::Table,
+ Facemock::Database::Application,
+ Facemock::Database::User,
+ Facemock::Database::Permission,
+ Facemock::Database::AuthorizationCode ]
+ klasses.each do |klass|
+ remove_dynamically_defined_class_method(klass)
+ remove_dynamically_defined_instance_method(klass)
+ end
+ end
+
# テストで動的に定義したクラスメソッドを削除
def remove_dynamically_defined_class_method(klass)
klass.methods.each do |method_name|
if method_name.to_s =~ /^find_by_/ || method_name.to_s =~ /^find_all_by_/
klass.class_eval do