Skip to content

Commit c10c123

Browse files
rashidspmikeproeng37
authored andcommitted
Get enabled features: Removes sorting (#98)
1 parent ff770c0 commit c10c123

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

lib/optimizely.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def get_enabled_features(user_id, attributes = nil)
319319
attributes
320320
) == true
321321
end
322-
enabled_features.sort
322+
enabled_features
323323
end
324324

325325
def get_feature_variable_string(feature_flag_key, variable_key, user_id, attributes = nil)

spec/project_spec.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -795,31 +795,6 @@ class InvalidErrorHandler; end
795795
# Checks prevented features should not return
796796
expect(project_instance.get_enabled_features('test_user', 'browser_type' => 'chrome')).not_to include(*disabled_features)
797797
end
798-
799-
it 'should return sorted feature keys' do
800-
# Mock is_feature_enabled and assert that is_feature_enabled does get called in an unsorted order
801-
expect(project_instance).to receive(:is_feature_enabled).with('boolean_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
802-
expect(project_instance).to receive(:is_feature_enabled).with('double_single_variable_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
803-
expect(project_instance).to receive(:is_feature_enabled).with('integer_single_variable_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
804-
expect(project_instance).to receive(:is_feature_enabled).with('boolean_single_variable_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
805-
expect(project_instance).to receive(:is_feature_enabled).with('string_single_variable_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
806-
expect(project_instance).to receive(:is_feature_enabled).with('multi_variate_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
807-
expect(project_instance).to receive(:is_feature_enabled).with('mutex_group_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
808-
expect(project_instance).to receive(:is_feature_enabled).with('empty_feature', 'test_user', 'browser_type' => 'chrome').and_return(true).ordered
809-
810-
expect(project_instance.get_enabled_features('test_user', 'browser_type' => 'chrome')).to eq(
811-
%w[
812-
boolean_feature
813-
boolean_single_variable_feature
814-
double_single_variable_feature
815-
empty_feature
816-
integer_single_variable_feature
817-
multi_variate_feature
818-
mutex_group_feature
819-
string_single_variable_feature
820-
]
821-
)
822-
end
823798
end
824799

825800
describe '#get_feature_variable_string' do

0 commit comments

Comments
 (0)