diff options
Diffstat (limited to 'qa/spec/runtime/feature_spec.rb')
-rw-r--r-- | qa/spec/runtime/feature_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/qa/spec/runtime/feature_spec.rb b/qa/spec/runtime/feature_spec.rb index 94638d99b01..db3c2f65963 100644 --- a/qa/spec/runtime/feature_spec.rb +++ b/qa/spec/runtime/feature_spec.rb @@ -25,6 +25,21 @@ describe QA::Runtime::Feature do end end + describe '.enable_and_verify' do + it 'enables a feature flag' do + allow(described_class).to receive(:get).and_return(response_get) + + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features/a-flag").and_return(request) + expect(described_class).to receive(:post) + .with(request.url, { value: true }).and_return(response_post) + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features").and_return(request) + + subject.enable_and_verify('a-flag') + end + end + describe '.disable' do it 'disables a feature flag' do expect(QA::Runtime::API::Request) @@ -40,6 +55,22 @@ describe QA::Runtime::Feature do end end + describe '.disable_and_verify' do + it 'disables a feature flag' do + allow(described_class).to receive(:get) + .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a-flag", "state": "off" }]')) + + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features/a-flag").and_return(request) + expect(described_class).to receive(:post) + .with(request.url, { value: false }).and_return(response_post) + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features").and_return(request) + + subject.disable_and_verify('a-flag') + end + end + describe '.enabled?' do it 'returns a feature flag state' do expect(QA::Runtime::API::Request) |