Skip to content

Commit dc0caa6

Browse files
author
Bilal Al
committed
fixed matcher logic
1 parent 8aa6bb9 commit dc0caa6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_semver_matcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def match?(args)
2323
@logger.log_if_debug('stringMatcherData is required for GREATER_THAN_OR_EQUAL_TO_SEMVER matcher type')
2424
return false
2525
end
26-
matches = [0, 1].include?(@semver.compare(SplitIoClient::Semver.new(value_to_match)))
26+
matches = [0, 1].include?(SplitIoClient::Semver.new(value_to_match).compare(@semver))
2727
@logger.log_if_debug("[GreaterThanOrEqualsToSemverMatcher] #{value_to_match} matches -> #{matches}")
2828
matches
2929
end

spec/engine/matchers/matches_greater_than_or_equal_to_semver_matcher_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
matcher = described_class.new("version", raw[:stringMatcherData], config.split_logger, config.split_validator)
2222
expect(matcher.match?(:attributes=>{"version": "2.1.8+rc"})).to eq(true)
2323
expect(matcher.match?(:attributes=>{"version": "2.1.8"})).to eq(true)
24-
expect(matcher.match?(:attributes=>{"version": "2.1.5"})).to eq(true)
25-
expect(matcher.match?(:attributes=>{"version": "2.1.5-rc1"})).to eq(true)
24+
expect(matcher.match?(:attributes=>{"version": "2.1.11"})).to eq(true)
25+
expect(matcher.match?(:attributes=>{"version": "2.2.0"})).to eq(true)
2626
end
2727

2828
it 'does not match' do
2929
matcher = described_class.new("version", raw[:stringMatcherData], config.split_logger, config.split_validator)
30-
expect(matcher.match?(:attributes=>{"version": "2.1.11"})).to eq(false)
31-
expect(matcher.match?(:attributes=>{"version": "2.2.0"})).to eq(false)
30+
expect(matcher.match?(:attributes=>{"version": "2.1.5"})).to eq(false)
31+
expect(matcher.match?(:attributes=>{"version": "2.1.5-rc1"})).to eq(false)
3232
end
3333

3434
it 'invalid attribute' do

0 commit comments

Comments
 (0)