-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10241 from DFE-Digital/545-part-2-remove-feature-…
…flag-from-database [545] part 2 remove feature flag from database
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
app/services/data_migrations/remove_new_withdrawal_reasons_feature_flag.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module DataMigrations | ||
class RemoveNewWithdrawalReasonsFeatureFlag | ||
TIMESTAMP = 20250109170301 | ||
MANUAL_RUN = false | ||
|
||
def change | ||
Feature.where(name: :new_candidate_withdrawal_reasons).delete_all | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
spec/services/data_migrations/remove_new_withdrawal_reasons_feature_flag_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe DataMigrations::RemoveNewWithdrawalReasonsFeatureFlag do | ||
context 'when the feature flag exist' do | ||
it 'removes the relevant feature flags' do | ||
create(:feature, name: 'new_candidate_withdrawal_reasons') | ||
create(:feature, name: 'some_other_feature_flag') | ||
|
||
expect { described_class.new.change }.to change { Feature.count }.by(-1) | ||
expect(Feature.where(name: 'new_candidate_withdrawal_reasons')).to be_none | ||
expect(Feature.where(name: 'some_other_feature_flag')).to be_any | ||
end | ||
end | ||
|
||
context 'when the feature flags have already been dropped' do | ||
it 'does nothing' do | ||
expect { described_class.new.change }.not_to(change { Feature.count }) | ||
end | ||
end | ||
end |