diff options
Diffstat (limited to 'spec/rubocop/cop/migration/schedule_async_spec.rb')
-rw-r--r-- | spec/rubocop/cop/migration/schedule_async_spec.rb | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/spec/rubocop/cop/migration/schedule_async_spec.rb b/spec/rubocop/cop/migration/schedule_async_spec.rb index 5f848dd9b66..09d2c77369c 100644 --- a/spec/rubocop/cop/migration/schedule_async_spec.rb +++ b/spec/rubocop/cop/migration/schedule_async_spec.rb @@ -53,6 +53,17 @@ RSpec.describe RuboCop::Cop::Migration::ScheduleAsync do end end + context 'CiDatabaseWorker.perform_async' do + it 'adds an offense when calling `CiDatabaseWorker.peform_async`' do + expect_offense(<<~RUBY) + def up + CiDatabaseWorker.perform_async(ClazzName, "Bar", "Baz") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't call [...] + end + RUBY + end + end + context 'BackgroundMigrationWorker.perform_in' do it 'adds an offense' do expect_offense(<<~RUBY) @@ -65,6 +76,18 @@ RSpec.describe RuboCop::Cop::Migration::ScheduleAsync do end end + context 'CiDatabaseWorker.perform_in' do + it 'adds an offense' do + expect_offense(<<~RUBY) + def up + CiDatabaseWorker + ^^^^^^^^^^^^^^^^ Don't call [...] + .perform_in(delay, ClazzName, "Bar", "Baz") + end + RUBY + end + end + context 'BackgroundMigrationWorker.bulk_perform_async' do it 'adds an offense' do expect_offense(<<~RUBY) @@ -77,12 +100,36 @@ RSpec.describe RuboCop::Cop::Migration::ScheduleAsync do end end + context 'CiDatabaseWorker.bulk_perform_async' do + it 'adds an offense' do + expect_offense(<<~RUBY) + def up + BackgroundMigration::CiDatabaseWorker + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't call [...] + .bulk_perform_async(jobs) + end + RUBY + end + end + context 'BackgroundMigrationWorker.bulk_perform_in' do it 'adds an offense' do expect_offense(<<~RUBY) def up - BackgroundMigrationWorker - ^^^^^^^^^^^^^^^^^^^^^^^^^ Don't call [...] + ::BackgroundMigrationWorker + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't call [...] + .bulk_perform_in(5.minutes, jobs) + end + RUBY + end + end + + context 'CiDatabaseWorker.bulk_perform_in' do + it 'adds an offense' do + expect_offense(<<~RUBY) + def up + ::BackgroundMigration::CiDatabaseWorker + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't call [...] .bulk_perform_in(5.minutes, jobs) end RUBY |