diff --git a/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb b/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb index 0a59c123..d9f8a098 100644 --- a/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb +++ b/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb @@ -14,6 +14,7 @@ def initialize(config) def add_bulk(impressions) impressions_json = impressions.map do |impression| + impression[:i][:properties] = impression[:i][:properties].to_json.to_s unless impression[:i][:properties].nil? impression.to_json end diff --git a/lib/splitclient-rb/version.rb b/lib/splitclient-rb/version.rb index d45f095e..adf700f9 100644 --- a/lib/splitclient-rb/version.rb +++ b/lib/splitclient-rb/version.rb @@ -1,3 +1,3 @@ module SplitIoClient - VERSION = '8.10.0' + VERSION = '8.10.1-rc1' end diff --git a/spec/cache/senders/impressions_formatter_spec.rb b/spec/cache/senders/impressions_formatter_spec.rb index 6c649a48..79b20c03 100644 --- a/spec/cache/senders/impressions_formatter_spec.rb +++ b/spec/cache/senders/impressions_formatter_spec.rb @@ -92,29 +92,55 @@ ] ) - expect(formatted_impressions.find { |i| i[:f] == :foo2 }[:i]).to match_array( - [ - { - k: 'matching_key2', - t: 'off', - m: 1_478_113_518_285, - b: 'foo2', - r: 'custom_label2', - c: 123_499, - pt: nil - }, - { - k: 'matching_key3', - t: 'off', - m: 1_478_113_518_900, - b: nil, - r: nil, - c: nil, - pt: nil, - properties: '{"prop":"val"}' - } - ] - ) + if cache_adapter == :redis + expect(formatted_impressions.find { |i| i[:f] == :foo2 }[:i]).to match_array( + [ + { + k: 'matching_key2', + t: 'off', + m: 1_478_113_518_285, + b: 'foo2', + r: 'custom_label2', + c: 123_499, + pt: nil + }, + { + k: 'matching_key3', + t: 'off', + m: 1_478_113_518_900, + b: nil, + r: nil, + c: nil, + pt: nil, + properties: '"{\"prop\":\"val\"}"' + } + ] + ) + else + expect(formatted_impressions.find { |i| i[:f] == :foo2 }[:i]).to match_array( + [ + { + k: 'matching_key2', + t: 'off', + m: 1_478_113_518_285, + b: 'foo2', + r: 'custom_label2', + c: 123_499, + pt: nil + }, + { + k: 'matching_key3', + t: 'off', + m: 1_478_113_518_900, + b: nil, + r: nil, + c: nil, + pt: nil, + properties: '{"prop":"val"}' + } + ] + ) + end end it 'filters out impressions with the same key/treatment' do diff --git a/spec/cache/senders/impressions_sender_spec.rb b/spec/cache/senders/impressions_sender_spec.rb index ccb5b885..3db870f7 100644 --- a/spec/cache/senders/impressions_sender_spec.rb +++ b/spec/cache/senders/impressions_sender_spec.rb @@ -55,6 +55,8 @@ end it 'post impressions with corresponding impressions metadata' do + skip "Test is not relevant for redis" if cache_adapter == :redis + stub_request(:post, 'https://events.split.io/api/testImpressions/bulk') .to_return(status: 200, body: 'ok') @@ -99,6 +101,7 @@ end it 'calls #post_impressions upon destroy' do + skip "Test is not relevant for redis" if cache_adapter == :redis stub_request(:post, 'https://events.split.io/api/testImpressions/bulk').to_return(status: 200, body: '') sender.call