Sha256: bae462d008161ccf1feac079714fecd6de3bd8ac7867c448a2922f9689386949
Contents?: true
Size: 1.11 KB
Versions: 19
Compression:
Stored size: 1.11 KB
Contents
module ARTest module SQLServer module CoerceableTest extend ActiveSupport::Concern included do cattr_accessor :coerced_tests, instance_accessor: false self.coerced_tests = [] end module ClassMethods def coerce_tests!(*methods) methods.each do |method| self.coerced_tests.push(method) coerced_test_warning(method) end end def coerce_all_tests! once = false instance_methods(false).each do |method| next unless method.to_s =~ /\Atest/ undef_method(method) once = true end STDOUT.puts "Info: Undefined all tests: #{self.name}" end private def coerced_test_warning(method) method = instance_methods(false).select { |m| m =~ method } if method.is_a?(Regexp) Array(method).each do |m| result = undef_method(m) if m && method_defined?(m) STDOUT.puts "Info: Undefined coerced test: #{self.name}##{m}" unless result.blank? end end end end end end
Version data entries
19 entries across 19 versions & 2 rubygems