|
127 | 127 | }] |
128 | 128 | } |
129 | 129 | repository.update([split], [], -1) |
130 | | - expect(repository.get_split('corge')[:conditions]).to eq [SplitIoClient::Cache::Repositories::SplitsRepository::DEFAULT_CONDITIONS_TEMPLATE] |
| 130 | + expect(repository.get_split('corge')[:conditions]).to eq SplitIoClient::Cache::Repositories::SplitsRepository::DEFAULT_CONDITIONS_TEMPLATE |
131 | 131 |
|
132 | 132 | # test with multiple conditions |
133 | | - split[:conditions] .append({ |
134 | | - partitions: [ |
135 | | - {treatment: 'on', size: 25}, |
136 | | - {treatment: 'off', size: 75} |
137 | | - ], |
138 | | - contitionType: 'WHITELIST', |
139 | | - label: 'some_other_label', |
140 | | - matcherGroup: { |
141 | | - matchers: [ |
142 | | - { |
143 | | - matcherType: 'ALL_KEYS', |
144 | | - negate: false, |
145 | | - } |
| 133 | + split2 = { |
| 134 | + name: 'corge2', |
| 135 | + trafficTypeName: 'tt_name_5', |
| 136 | + conditions: [ |
| 137 | + { |
| 138 | + partitions: [ |
| 139 | + {treatment: 'on', size: 50}, |
| 140 | + {treatment: 'off', size: 50} |
| 141 | + ], |
| 142 | + contitionType: 'WHITELIST', |
| 143 | + label: 'some_label', |
| 144 | + matcherGroup: { |
| 145 | + matchers: [ |
| 146 | + { |
| 147 | + matcherType: 'UNDEFINED', |
| 148 | + whitelistMatcherData: { |
| 149 | + whitelist: ['k1', 'k2', 'k3'] |
| 150 | + }, |
| 151 | + negate: false, |
| 152 | + } |
| 153 | + ], |
| 154 | + combiner: 'AND' |
| 155 | + } |
| 156 | + }, |
| 157 | + { |
| 158 | + partitions: [ |
| 159 | + {treatment: 'on', size: 25}, |
| 160 | + {treatment: 'off', size: 75} |
146 | 161 | ], |
147 | | - combiner: 'AND' |
| 162 | + contitionType: 'WHITELIST', |
| 163 | + label: 'some_other_label', |
| 164 | + matcherGroup: { |
| 165 | + matchers: [{matcherType: 'ALL_KEYS', negate: false}], |
| 166 | + combiner: 'AND' |
| 167 | + } |
| 168 | + }] |
148 | 169 | } |
149 | | - }) |
150 | | - repository.update([split], [], -1) |
151 | | - expect(repository.get_split('corge')[:conditions]).to eq [SplitIoClient::Cache::Repositories::SplitsRepository::DEFAULT_CONDITIONS_TEMPLATE] |
| 170 | + |
| 171 | + repository.update([split2], [], -1) |
| 172 | + expect(repository.get_split('corge2')[:conditions]).to eq SplitIoClient::Cache::Repositories::SplitsRepository::DEFAULT_CONDITIONS_TEMPLATE |
152 | 173 | end |
153 | 174 | end |
154 | 175 |
|
|
0 commit comments