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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
5fa9d6a1
Commit
5fa9d6a1
authored
Jun 27, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename FLippable to FeatureGate and make `flipper_group` and `user` mutually exclusive
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
b4d325c8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
16 deletions
+24
-16
app/models/concerns/feature_gate.rb
app/models/concerns/feature_gate.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
doc/api/features.md
doc/api/features.md
+2
-0
lib/api/features.rb
lib/api/features.rb
+1
-0
spec/models/concerns/feature_gate_spec.rb
spec/models/concerns/feature_gate_spec.rb
+19
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+0
-14
No files found.
app/models/concerns/f
lippabl
e.rb
→
app/models/concerns/f
eature_gat
e.rb
View file @
5fa9d6a1
module
F
lippabl
e
module
F
eatureGat
e
def
flipper_id
return
nil
if
new_record?
...
...
app/models/user.rb
View file @
5fa9d6a1
...
...
@@ -11,7 +11,7 @@ class User < ActiveRecord::Base
include
CaseSensitivity
include
TokenAuthenticatable
include
IgnorableColumn
include
F
lippabl
e
include
F
eatureGat
e
DEFAULT_NOTIFICATION_LEVEL
=
:participating
...
...
doc/api/features.md
View file @
5fa9d6a1
...
...
@@ -61,6 +61,8 @@ POST /features/:name
|
`flipper_group`
| string | no | A Flipper group name |
|
`user`
| string | no | A GitLab username |
Note that
`flipper_group`
and
`user`
are mutually exclusive.
```
bash
curl
--data
"value=30"
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v4/features/new_library
```
...
...
lib/api/features.rb
View file @
5fa9d6a1
...
...
@@ -42,6 +42,7 @@ module API
requires
:value
,
type:
String
,
desc:
'`true` or `false` to enable/disable, an integer for percentage of time'
optional
:flipper_group
,
type:
String
,
desc:
'A Flipper group name'
optional
:user
,
type:
String
,
desc:
'A GitLab username'
mutually_exclusive
:flipper_group
,
:user
end
post
':name'
do
feature
=
Feature
.
get
(
params
[
:name
])
...
...
spec/models/concerns/feature_gate_spec.rb
0 → 100644
View file @
5fa9d6a1
require
'spec_helper'
describe
FeatureGate
do
describe
'User'
do
describe
'#flipper_id'
do
context
'when user is not persisted'
do
let
(
:user
)
{
build
(
:user
)
}
it
{
expect
(
user
.
flipper_id
).
to
be_nil
}
end
context
'when user is persisted'
do
let
(
:user
)
{
create
(
:user
)
}
it
{
expect
(
user
.
flipper_id
).
to
eq
"User:
#{
user
.
id
}
"
}
end
end
end
end
spec/models/user_spec.rb
View file @
5fa9d6a1
...
...
@@ -430,20 +430,6 @@ describe User, models: true do
end
end
describe
'#flipper_id'
do
context
'when user is not persisted'
do
let
(
:user
)
{
build
(
:user
)
}
it
{
expect
(
user
.
flipper_id
).
to
be_nil
}
end
context
'when user is persisted'
do
let
(
:user
)
{
create
(
:user
)
}
it
{
expect
(
user
.
flipper_id
).
to
eq
"User:
#{
user
.
id
}
"
}
end
end
describe
'#generate_password'
do
it
"does not generate password by default"
do
user
=
create
(
:user
,
password:
'abcdefghe'
)
...
...
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