lib/rocket_job/dirmon_entry.rb in rocketjob-1.1.1 vs lib/rocket_job/dirmon_entry.rb in rocketjob-1.1.2
- old
+ new
@@ -127,11 +127,11 @@
# @formatter:on
validates_presence_of :pattern, :job_class_name, :perform_method
validates_each :perform_method do |record, attr, value|
- if (klass = record.job_class) && !klass.instance_method(value)
+ if (klass = record.job_class) && !klass.instance_methods.include?(value)
record.errors.add(attr, "Method not implemented by #{record.job_class_name}")
end
end
validates_each :job_class_name do |record, attr, value|
@@ -143,10 +143,10 @@
end
record.errors.add(attr, 'job_class_name must be defined and must be derived from RocketJob::Job') unless exists
end
validates_each :arguments do |record, attr, value|
- if (klass = record.job_class)
+ if (klass = record.job_class) && klass.instance_methods.include?(record.perform_method)
count = klass.argument_count(record.perform_method)
record.errors.add(attr, "There must be #{count} argument(s)") if value.size != count
end
end