|
34 | 34 |
|
35 | 35 | it 'return false if excluded rb segment is matched' do |
36 | 36 | rbs_repositoy = SplitIoClient::Cache::Repositories::RuleBasedSegmentsRepository.new(config) |
37 | | - rbs = {:name => 'sample_rule_based_segment', :trafficTypeName => 'tt_name_1', :conditions => [], :excluded => {:keys => [], :segments => [{:name => 'no_excludes', :type => 'rule-based'}]}} |
| 37 | + rbs = {:name => 'sample_rule_based_segment', :trafficTypeName => 'tt_name_1', :conditions => [{ |
| 38 | + :matcherGroup => { |
| 39 | + :combiner => "AND", |
| 40 | + :matchers => [ |
| 41 | + { |
| 42 | + :matcherType => "WHITELIST", |
| 43 | + :negate => false, |
| 44 | + :userDefinedSegmentMatcherData => nil, |
| 45 | + :whitelistMatcherData => { |
| 46 | + :whitelist => [ |
| 47 | + "bilal@split.io", |
| 48 | + "bilal" |
| 49 | + ] |
| 50 | + }, |
| 51 | + :unaryNumericMatcherData => nil, |
| 52 | + :betweenMatcherData => nil |
| 53 | + } |
| 54 | + ] |
| 55 | + } |
| 56 | + }], :excluded => {:keys => [], :segments => [{:name => 'no_excludes', :type => 'rule-based'}]}} |
38 | 57 | rbs2 = {:name => 'no_excludes', :trafficTypeName => 'tt_name_1', |
39 | 58 | :conditions => [{ |
40 | 59 | :matcherGroup => { |
|
61 | 80 | rbs_repositoy.update([rbs, rbs2], [], -1) |
62 | 81 | matcher = described_class.new(segments_repository, rbs_repositoy, 'sample_rule_based_segment', config) |
63 | 82 | expect(matcher.match?(value: 'bilal@split.io', attributes: {'email': 'bilal@split.io'})).to be false |
64 | | - expect(matcher.match?(value: 'bilal', attributes: {'email': 'bilal'})).to be false |
| 83 | + expect(matcher.match?(value: 'bilal', attributes: {'email': 'bilal'})).to be true |
65 | 84 | end |
66 | 85 |
|
67 | 86 | it 'return true if condition matches' do |
|
0 commit comments