From e5a7d1da8cfda5dc3755b6a0a1ed450415f39873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 5 Jul 2017 21:55:27 +0200 Subject: Improve Features API and its docs and add a Changelog item MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/requests/api/features_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec/requests/api/features_spec.rb') diff --git a/spec/requests/api/features_spec.rb b/spec/requests/api/features_spec.rb index 1d8aaeea8f2..7e21006b254 100644 --- a/spec/requests/api/features_spec.rb +++ b/spec/requests/api/features_spec.rb @@ -113,6 +113,20 @@ describe API::Features do { 'key' => 'actors', 'value' => ["User:#{user.id}"] } ]) end + + it 'creates an enabled feature for the given user and feature group when passed user=username and feature_group=perf_team' do + post api("/features/#{feature_name}", admin), value: 'true', user: user.username, feature_group: 'perf_team' + + expect(response).to have_http_status(201) + expect(json_response).to eq( + 'name' => 'my_feature', + 'state' => 'conditional', + 'gates' => [ + { 'key' => 'boolean', 'value' => false }, + { 'key' => 'groups', 'value' => ['perf_team'] }, + { 'key' => 'actors', 'value' => ["User:#{user.id}"] } + ]) + end end it 'creates a feature with the given percentage if passed an integer' do -- cgit v1.2.1