test/plugins/job/defaults_test.rb in rocketjob-2.1.3 vs test/plugins/job/defaults_test.rb in rocketjob-3.0.0.alpha

- old
+ new

@@ -4,37 +4,39 @@ module Job # Unit Test for RocketJob::Job class DefaultsTest < Minitest::Test class ParentJob < RocketJob::Job - rocket_job do |job| - job.priority = 53 - job.description = 'Hello' - end + self.priority = 53 + self.description = 'Hello' def perform end end class ChildJob < ParentJob - rocket_job do |job| - job.priority = 72 - end + self.priority = 72 def perform end end - describe RocketJob::Plugins::Job::Defaults do + describe RocketJob::Plugins::Job do after do @job.destroy if @job && !@job.new_record? end describe '.rocket_job' do it 'sets defaults after initialize' do @job = ParentJob.new assert_equal 53, @job.priority assert_equal 'Hello', @job.description + end + + it 'can override defaults on initialize' do + @job = ParentJob.new(priority: 72, description: 'More') + assert_equal 72, @job.priority + assert_equal 'More', @job.description end it 'allows a child to override parent defaults' do @job = ChildJob.new assert_equal 72, @job.priority