Skip to content

Commit 45fbd0b

Browse files
author
Bilal Al
committed
polish
1 parent 93d73b0 commit 45fbd0b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def match?(args)
2020

2121
value_to_match = args[:attributes][@attribute.to_sym]
2222
unless value_to_match.is_a?(String)
23-
@logger.error('stringMatcherData is required for EQUAL_TO_SEMVER matcher type')
23+
@logger.log_if_debug('stringMatcherData is required for EQUAL_TO_SEMVER matcher type')
2424
return false
2525
end
2626
matches = @semver.compare(SplitIoClient::Semver.new(value_to_match)).zero?

spec/engine/matchers/matches_equal_to_semver_matcher_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,11 @@
2828
expect(matcher.match?(:attributes=>{"version": "2.1.5"})).to eq(false)
2929
expect(matcher.match?(:attributes=>{"version": "2.1.5-rc1"})).to eq(false)
3030
end
31+
32+
it 'invalid attribute' do
33+
matcher = described_class.new("version", raw[:stringMatcherData], config.split_logger, config.split_validator)
34+
expect(matcher.match?(:attributes=>{"version": 2.1})).to eq(false)
35+
expect(matcher.match?(:attributes=>{"version": nil})).to eq(false)
36+
end
37+
3138
end

0 commit comments

Comments
 (0)