Commit 8c952067 authored by Nick Thomas's avatar Nick Thomas

Rename some local variables from default_scope

`default_scope` is an AR-reserved word and we're introducing a cop to
ban it, so this is a simple thing we can do to avoid a conflict. More
generally, we should never have used this name, since overriding AR
methods can have all sorts of pain.
parent 40776877
...@@ -30,22 +30,22 @@ RSpec.describe Operations::FeatureFlagScope do ...@@ -30,22 +30,22 @@ RSpec.describe Operations::FeatureFlagScope do
context 'when environment scope of a default scope is updated' do context 'when environment scope of a default scope is updated' do
let!(:feature_flag) { create(:operations_feature_flag) } let!(:feature_flag) { create(:operations_feature_flag) }
let!(:default_scope) { feature_flag.default_scope } let!(:scope_default) { feature_flag.default_scope }
it 'keeps default scope intact' do it 'keeps default scope intact' do
default_scope.update(environment_scope: 'review/*') scope_default.update(environment_scope: 'review/*')
expect(default_scope.errors[:environment_scope]) expect(scope_default.errors[:environment_scope])
.to include("cannot be changed from default scope") .to include("cannot be changed from default scope")
end end
end end
context 'when a default scope is destroyed' do context 'when a default scope is destroyed' do
let!(:feature_flag) { create(:operations_feature_flag) } let!(:feature_flag) { create(:operations_feature_flag) }
let!(:default_scope) { feature_flag.default_scope } let!(:scope_default) { feature_flag.default_scope }
it 'prevents from destroying the default scope' do it 'prevents from destroying the default scope' do
expect { default_scope.destroy! }.to raise_error(ActiveRecord::ReadOnlyRecord) expect { scope_default.destroy! }.to raise_error(ActiveRecord::ReadOnlyRecord)
end end
end end
......
...@@ -238,7 +238,7 @@ RSpec.describe API::FeatureFlags do ...@@ -238,7 +238,7 @@ RSpec.describe API::FeatureFlags do
end end
describe 'POST /projects/:id/feature_flags' do describe 'POST /projects/:id/feature_flags' do
def default_scope def scope_default
{ {
environment_scope: '*', environment_scope: '*',
active: false, active: false,
...@@ -253,7 +253,7 @@ RSpec.describe API::FeatureFlags do ...@@ -253,7 +253,7 @@ RSpec.describe API::FeatureFlags do
let(:params) do let(:params) do
{ {
name: 'awesome-feature', name: 'awesome-feature',
scopes: [default_scope] scopes: [scope_default]
} }
end end
...@@ -328,7 +328,7 @@ RSpec.describe API::FeatureFlags do ...@@ -328,7 +328,7 @@ RSpec.describe API::FeatureFlags do
name: 'awesome-feature', name: 'awesome-feature',
description: 'this is awesome', description: 'this is awesome',
scopes: [ scopes: [
default_scope, scope_default,
scope_with_user_with_id scope_with_user_with_id
] ]
} }
......
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