Commit a1e9070d authored by Felipe Artur's avatar Felipe Artur

Remove save_description_versions feature flag

Remove save_description_versions feature flag.
The flag is defaulted to on.
parent 516702b3
......@@ -16,7 +16,6 @@ module VersionedDescription
def save_description_version
self.saved_description_version = nil
return unless Feature.enabled?(:save_description_versions, issuing_parent, default_enabled: true)
return unless saved_change_to_description?
unless description_versions.exists?
......
......@@ -9,54 +9,36 @@ RSpec.shared_examples 'versioned description' do
let(:factory_name) { described_class.name.underscore.to_sym }
let!(:model) { create(factory_name, description: 'Original description') }
context 'when feature is enabled' do
context 'when description was changed' do
before do
stub_feature_flags(save_description_versions: true)
model.update!(description: 'New description')
end
context 'when description was changed' do
before do
model.update!(description: 'New description')
end
it 'saves the old and new description for the first update' do
expect(model.description_versions.first.description).to eq('Original description')
expect(model.description_versions.last.description).to eq('New description')
end
it 'only saves the new description for subsequent updates' do
expect { model.update!(description: 'Another description') }.to change { model.description_versions.count }.by(1)
expect(model.description_versions.last.description).to eq('Another description')
end
it 'saves the old and new description for the first update' do
expect(model.description_versions.first.description).to eq('Original description')
expect(model.description_versions.last.description).to eq('New description')
end
it 'sets the new description version to `saved_description_version`' do
expect(model.saved_description_version).to eq(model.description_versions.last)
end
it 'only saves the new description for subsequent updates' do
expect { model.update!(description: 'Another description') }.to change { model.description_versions.count }.by(1)
it 'clears `saved_description_version` after another save that does not change description' do
model.save!
expect(model.description_versions.last.description).to eq('Another description')
end
expect(model.saved_description_version).to be_nil
end
it 'sets the new description version to `saved_description_version`' do
expect(model.saved_description_version).to eq(model.description_versions.last)
end
context 'when description was not changed' do
it 'does not save any description version' do
expect { model.save! }.not_to change { model.description_versions.count }
it 'clears `saved_description_version` after another save that does not change description' do
model.save!
expect(model.saved_description_version).to be_nil
end
expect(model.saved_description_version).to be_nil
end
end
context 'when feature is disabled' do
before do
stub_feature_flags(save_description_versions: false)
end
context 'when description was not changed' do
it 'does not save any description version' do
expect { model.update!(description: 'New description') }.not_to change { model.description_versions.count }
expect { model.save! }.not_to change { model.description_versions.count }
expect(model.saved_description_version).to be_nil
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment