Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
72462cc7
Commit
72462cc7
authored
Sep 30, 2020
by
Jason Goodman
Committed by
Douglas Barbosa Alexandre
Sep 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove feature flag model spec from rubocop save bang todo
Fixup validation specs
parent
a2ddaaed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
.rubocop_todo.yml
.rubocop_todo.yml
+0
-1
spec/models/operations/feature_flag_spec.rb
spec/models/operations/feature_flag_spec.rb
+10
-8
No files found.
.rubocop_todo.yml
View file @
72462cc7
...
@@ -1056,7 +1056,6 @@ Rails/SaveBang:
...
@@ -1056,7 +1056,6 @@ Rails/SaveBang:
-
'
spec/models/note_spec.rb'
-
'
spec/models/note_spec.rb'
-
'
spec/models/notification_setting_spec.rb'
-
'
spec/models/notification_setting_spec.rb'
-
'
spec/models/operations/feature_flag_scope_spec.rb'
-
'
spec/models/operations/feature_flag_scope_spec.rb'
-
'
spec/models/operations/feature_flag_spec.rb'
-
'
spec/models/operations/feature_flags/strategy_spec.rb'
-
'
spec/models/operations/feature_flags/strategy_spec.rb'
-
'
spec/models/operations/feature_flags/user_list_spec.rb'
-
'
spec/models/operations/feature_flags/user_list_spec.rb'
-
'
spec/models/pages_domain_spec.rb'
-
'
spec/models/pages_domain_spec.rb'
...
...
spec/models/operations/feature_flag_spec.rb
View file @
72462cc7
...
@@ -21,7 +21,7 @@ RSpec.describe Operations::FeatureFlag do
...
@@ -21,7 +21,7 @@ RSpec.describe Operations::FeatureFlag do
context
'a version 1 feature flag'
do
context
'a version 1 feature flag'
do
it
'is valid if associated with Operations::FeatureFlagScope models'
do
it
'is valid if associated with Operations::FeatureFlagScope models'
do
project
=
create
(
:project
)
project
=
create
(
:project
)
feature_flag
=
described_class
.
create
({
name:
'test'
,
project:
project
,
version:
1
,
feature_flag
=
described_class
.
create
!
({
name:
'test'
,
project:
project
,
version:
1
,
scopes_attributes:
[{
environment_scope:
'*'
,
active:
false
}]
})
scopes_attributes:
[{
environment_scope:
'*'
,
active:
false
}]
})
expect
(
feature_flag
).
to
be_valid
expect
(
feature_flag
).
to
be_valid
...
@@ -29,9 +29,10 @@ RSpec.describe Operations::FeatureFlag do
...
@@ -29,9 +29,10 @@ RSpec.describe Operations::FeatureFlag do
it
'is invalid if associated with Operations::FeatureFlags::Strategy models'
do
it
'is invalid if associated with Operations::FeatureFlags::Strategy models'
do
project
=
create
(
:project
)
project
=
create
(
:project
)
feature_flag
=
described_class
.
create
({
name:
'test'
,
project:
project
,
version:
1
,
feature_flag
=
described_class
.
new
({
name:
'test'
,
project:
project
,
version:
1
,
strategies_attributes:
[{
name:
'default'
,
parameters:
{}
}]
})
strategies_attributes:
[{
name:
'default'
,
parameters:
{}
}]
})
expect
(
feature_flag
.
valid?
).
to
eq
(
false
)
expect
(
feature_flag
.
errors
.
messages
).
to
eq
({
expect
(
feature_flag
.
errors
.
messages
).
to
eq
({
version_associations:
[
"version 1 feature flags may not have strategies"
]
version_associations:
[
"version 1 feature flags may not have strategies"
]
})
})
...
@@ -41,9 +42,10 @@ RSpec.describe Operations::FeatureFlag do
...
@@ -41,9 +42,10 @@ RSpec.describe Operations::FeatureFlag do
context
'a version 2 feature flag'
do
context
'a version 2 feature flag'
do
it
'is invalid if associated with Operations::FeatureFlagScope models'
do
it
'is invalid if associated with Operations::FeatureFlagScope models'
do
project
=
create
(
:project
)
project
=
create
(
:project
)
feature_flag
=
described_class
.
create
({
name:
'test'
,
project:
project
,
version:
2
,
feature_flag
=
described_class
.
new
({
name:
'test'
,
project:
project
,
version:
2
,
scopes_attributes:
[{
environment_scope:
'*'
,
active:
false
}]
})
scopes_attributes:
[{
environment_scope:
'*'
,
active:
false
}]
})
expect
(
feature_flag
.
valid?
).
to
eq
(
false
)
expect
(
feature_flag
.
errors
.
messages
).
to
eq
({
expect
(
feature_flag
.
errors
.
messages
).
to
eq
({
version_associations:
[
"version 2 feature flags may not have scopes"
]
version_associations:
[
"version 2 feature flags may not have scopes"
]
})
})
...
@@ -51,7 +53,7 @@ RSpec.describe Operations::FeatureFlag do
...
@@ -51,7 +53,7 @@ RSpec.describe Operations::FeatureFlag do
it
'is valid if associated with Operations::FeatureFlags::Strategy models'
do
it
'is valid if associated with Operations::FeatureFlags::Strategy models'
do
project
=
create
(
:project
)
project
=
create
(
:project
)
feature_flag
=
described_class
.
create
({
name:
'test'
,
project:
project
,
version:
2
,
feature_flag
=
described_class
.
create
!
({
name:
'test'
,
project:
project
,
version:
2
,
strategies_attributes:
[{
name:
'default'
,
parameters:
{}
}]
})
strategies_attributes:
[{
name:
'default'
,
parameters:
{}
}]
})
expect
(
feature_flag
).
to
be_valid
expect
(
feature_flag
).
to
be_valid
...
@@ -71,7 +73,7 @@ RSpec.describe Operations::FeatureFlag do
...
@@ -71,7 +73,7 @@ RSpec.describe Operations::FeatureFlag do
it
'defaults to 1 if unspecified'
do
it
'defaults to 1 if unspecified'
do
project
=
create
(
:project
)
project
=
create
(
:project
)
feature_flag
=
described_class
.
create
(
name:
'my_flag'
,
project:
project
,
active:
true
)
feature_flag
=
described_class
.
create
!
(
name:
'my_flag'
,
project:
project
,
active:
true
)
expect
(
feature_flag
).
to
be_valid
expect
(
feature_flag
).
to
be_valid
expect
(
feature_flag
.
version_before_type_cast
).
to
eq
(
1
)
expect
(
feature_flag
.
version_before_type_cast
).
to
eq
(
1
)
...
@@ -109,14 +111,14 @@ RSpec.describe Operations::FeatureFlag do
...
@@ -109,14 +111,14 @@ RSpec.describe Operations::FeatureFlag do
context
'with a version 1 feature flag'
do
context
'with a version 1 feature flag'
do
it
'creates a default scope'
do
it
'creates a default scope'
do
feature_flag
=
described_class
.
create
({
name:
'test'
,
project:
project
,
scopes_attributes:
[],
version:
1
})
feature_flag
=
described_class
.
create
!
({
name:
'test'
,
project:
project
,
scopes_attributes:
[],
version:
1
})
expect
(
feature_flag
.
scopes
.
count
).
to
eq
(
1
)
expect
(
feature_flag
.
scopes
.
count
).
to
eq
(
1
)
expect
(
feature_flag
.
scopes
.
first
.
environment_scope
).
to
eq
(
'*'
)
expect
(
feature_flag
.
scopes
.
first
.
environment_scope
).
to
eq
(
'*'
)
end
end
it
'allows specifying the default scope in the parameters'
do
it
'allows specifying the default scope in the parameters'
do
feature_flag
=
described_class
.
create
({
name:
'test'
,
project:
project
,
feature_flag
=
described_class
.
create
!
({
name:
'test'
,
project:
project
,
scopes_attributes:
[{
environment_scope:
'*'
,
active:
false
},
scopes_attributes:
[{
environment_scope:
'*'
,
active:
false
},
{
environment_scope:
'review/*'
,
active:
true
}],
version:
1
})
{
environment_scope:
'review/*'
,
active:
true
}],
version:
1
})
...
@@ -127,7 +129,7 @@ RSpec.describe Operations::FeatureFlag do
...
@@ -127,7 +129,7 @@ RSpec.describe Operations::FeatureFlag do
context
'with a version 2 feature flag'
do
context
'with a version 2 feature flag'
do
it
'does not create a default scope'
do
it
'does not create a default scope'
do
feature_flag
=
described_class
.
create
({
name:
'test'
,
project:
project
,
scopes_attributes:
[],
version:
2
})
feature_flag
=
described_class
.
create
!
({
name:
'test'
,
project:
project
,
scopes_attributes:
[],
version:
2
})
expect
(
feature_flag
.
scopes
).
to
eq
([])
expect
(
feature_flag
.
scopes
).
to
eq
([])
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment