Skip to content

Add rubocop to detect migration_has_finished? stubbing

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Background

Currently, we sometimes stub migration_has_finished? in specs directly when we should use set_elasticsearch_migration_to instead.

Proposal

We should add a Rubocop to detect

allow(::Elastic::DataMigrationService).to receive(:migration_has_finished?).with(...).and_return(true)

and mark it as an offense.

Another benefit of using set_elasticsearch_migration_to is that it would detect a typo in the migration name and raise an exception.

Edited by 🤖 GitLab Bot 🤖