Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/splitclient-rb/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SplitIoClient
VERSION = '8.10.0'
VERSION = '8.10.1-rc1'
end
72 changes: 49 additions & 23 deletions spec/cache/senders/impressions_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions spec/cache/senders/impressions_sender_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand Down
Loading