Skip to content
This repository was archived by the owner on Jun 28, 2023. It is now read-only.

Commit db3d51a

Browse files
committed
Make “User Group” matches case in-sensitive.
1 parent 261afa3 commit db3d51a

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

HISTORY

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
= 2.2.1 / 2014-10-16
2+
3+
* Make "User Group" matches case in-sensitive
4+
15
= 2.2.0 / 2014-10-07
26

37
* [Feature] Bandiera *should* now support all RDBMs supported by Sequel (note: we ONLY test on MySQL at present)

lib/bandiera/feature.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ def percentage_enabled_for_user?(user)
7878
end
7979

8080
def cleaned_user_groups_list
81-
user_groups_list.reject { |elm| elm.nil? || elm.empty? }
81+
user_groups_list.reject { |elm| elm.nil? || elm.empty? }.map(&:downcase)
8282
end
8383

8484
def user_group_within_list?(user_group)
85-
!user_groups_list.empty? && cleaned_user_groups_list.include?(user_group)
85+
!user_groups_list.empty? && cleaned_user_groups_list.include?(user_group.downcase)
8686
end
8787

8888
def user_group_match_regex?(user_group)

lib/bandiera/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Bandiera
2-
VERSION = '2.2.0'
2+
VERSION = '2.2.1'
33
end

spec/lib/bandiera/feature_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
it 'if the user_group is in the list' do
5555
expect(subject.enabled?(user_group: user_group)).to eq true
5656
end
57+
58+
it 'if the user_group is in the list regardless of case' do
59+
expect(subject.enabled?(user_group: user_group.upcase)).to eq true
60+
end
5761
end
5862

5963
context 'returns false' do

0 commit comments

Comments
 (0)