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
213716a4
Commit
213716a4
authored
Jan 12, 2022
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for feature_flags_available? method
parent
05204f2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
spec/lib/feature_spec.rb
spec/lib/feature_spec.rb
+26
-0
No files found.
spec/lib/feature_spec.rb
View file @
213716a4
...
...
@@ -11,6 +11,32 @@ RSpec.describe Feature, stub_feature_flags: false do
skip_feature_flags_yaml_validation
end
describe
'.feature_flags_available?'
do
it
'returns false on connection error'
do
expect
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:active?
).
and_raise
(
PG
::
ConnectionBad
)
# rubocop:disable Database/MultipleDatabases
expect
(
described_class
.
feature_flags_available?
).
to
eq
(
false
)
end
it
'returns false when connection is not active'
do
expect
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:active?
).
and_return
(
false
)
# rubocop:disable Database/MultipleDatabases
expect
(
described_class
.
feature_flags_available?
).
to
eq
(
false
)
end
it
'returns false when the flipper table does not exist'
do
expect
(
Feature
::
FlipperFeature
).
to
receive
(
:table_exists?
).
and_return
(
false
)
expect
(
described_class
.
feature_flags_available?
).
to
eq
(
false
)
end
it
'returns false on NoDatabaseError'
do
expect
(
Feature
::
FlipperFeature
).
to
receive
(
:table_exists?
).
and_raise
(
ActiveRecord
::
NoDatabaseError
)
expect
(
described_class
.
feature_flags_available?
).
to
eq
(
false
)
end
end
describe
'.get'
do
let
(
:feature
)
{
double
(
:feature
)
}
let
(
:key
)
{
'my_feature'
}
...
...
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