test/dirmon_entry_test.rb in rocketjob-1.1.1 vs test/dirmon_entry_test.rb in rocketjob-1.1.2

- old
+ new

@@ -95,18 +95,38 @@ assert entry = RocketJob::DirmonEntry.new(job_class_name: 'Jobs::TestJob') assert_equal false, entry.valid? assert_equal ["can't be blank"], entry.errors[:pattern], entry.errors.inspect end + context 'perform_method' do + context 'with an invalid method' do + should 'add errors to the entry' do + entry = RocketJob::DirmonEntry.new(job_class_name: 'Jobs::TestJob', perform_method: :missing_perform_method) + assert_equal false, entry.valid? + assert_equal ['Method not implemented by Jobs::TestJob'], entry.errors[:perform_method], entry.errors.inspect + end + end + end + context 'job_class_name' do should 'ensure presence' do assert entry = RocketJob::DirmonEntry.new(pattern: '/abc/**') assert_equal false, entry.valid? assert_equal ["can't be blank", 'job_class_name must be defined and must be derived from RocketJob::Job'], entry.errors[:job_class_name], entry.errors.inspect end end context 'arguments' do + should 'allow no arguments' do + assert entry = RocketJob::DirmonEntry.new( + job_class_name: 'Jobs::TestJob', + pattern: '/abc/**', + perform_method: :result + ) + assert_equal true, entry.valid?, entry.errors.inspect + assert_equal [], entry.errors[:arguments], entry.errors.inspect + end + should 'ensure correct number of arguments' do assert entry = RocketJob::DirmonEntry.new( job_class_name: 'Jobs::TestJob', pattern: '/abc/**' )