Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 16:26:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 16:26:31 +0300
commitb7dfe2ae4054aa40e15182fd3c6cb7dd39f131db (patch)
tree5ab080ca9cadeb6cd9578bf301e4e9e8810bed9e /qa/spec
parent25cb337cf12438169f1b14bc5dace8a06a7356e3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/spec')
-rw-r--r--qa/spec/runtime/feature_spec.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/qa/spec/runtime/feature_spec.rb b/qa/spec/runtime/feature_spec.rb
index 192299b7857..94638d99b01 100644
--- a/qa/spec/runtime/feature_spec.rb
+++ b/qa/spec/runtime/feature_spec.rb
@@ -3,7 +3,8 @@
describe QA::Runtime::Feature do
let(:api_client) { double('QA::Runtime::API::Client') }
let(:request) { Struct.new(:url).new('http://api') }
- let(:response) { Struct.new(:code).new(201) }
+ let(:response_post) { Struct.new(:code).new(201) }
+ let(:response_get) { Struct.new(:code, :body).new(200, '[{ "name": "a-flag", "state": "on" }]') }
before do
allow(described_class).to receive(:api_client).and_return(api_client)
@@ -18,7 +19,7 @@ describe QA::Runtime::Feature do
expect(described_class)
.to receive(:post)
.with(request.url, { value: true })
- .and_return(response)
+ .and_return(response_post)
subject.enable('a-flag')
end
@@ -33,9 +34,23 @@ describe QA::Runtime::Feature do
expect(described_class)
.to receive(:post)
.with(request.url, { value: false })
- .and_return(response)
+ .and_return(response_post)
subject.disable('a-flag')
end
end
+
+ describe '.enabled?' do
+ it 'returns a feature flag state' do
+ expect(QA::Runtime::API::Request)
+ .to receive(:new)
+ .with(api_client, "/features")
+ .and_return(request)
+ expect(described_class)
+ .to receive(:get)
+ .and_return(response_get)
+
+ expect(subject.enabled?('a-flag')).to be_truthy
+ end
+ end
end