From b3912941df8cc63b14041a6cdc7104bd2c35e358 Mon Sep 17 00:00:00 2001 From: Benjamin Clot Date: Wed, 1 Feb 2017 10:26:38 +0100 Subject: [PATCH 1/2] Add a floor variable --- src/adapters/rubicon.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/adapters/rubicon.js b/src/adapters/rubicon.js index 8baccc2dd87..bddbc72629e 100644 --- a/src/adapters/rubicon.js +++ b/src/adapters/rubicon.js @@ -85,6 +85,7 @@ function RubiconAdapter() { siteId, zoneId, position, + floor, keywords, visitor, inventory, @@ -93,6 +94,7 @@ function RubiconAdapter() { } = bid.params; // defaults + floor = (floor = parseFloat(floor)) > 0.01 ? floor : 0.01; position = position || 'btf'; // use rubicon sizes if provided, otherwise adUnit.sizes @@ -112,7 +114,7 @@ function RubiconAdapter() { 'size_id', parsedSizes[0], 'alt_size_ids', parsedSizes.slice(1).join(',') || undefined, 'p_pos', position, - 'rp_floor', '0.01', + 'rp_floor', floor, 'tk_flint', 'pbjs.lite', 'p_screen_res', window.screen.width +'x'+ window.screen.height, 'kw', keywords, From c7d3d6971e2400a4a20511815c4bbc50bdc6a464 Mon Sep 17 00:00:00 2001 From: Benjamin Clot Date: Tue, 7 Feb 2017 22:09:56 +0100 Subject: [PATCH 2/2] Added floor parameter test --- test/spec/adapters/rubicon_spec.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/spec/adapters/rubicon_spec.js b/test/spec/adapters/rubicon_spec.js index a875def399f..cc16579c29d 100644 --- a/test/spec/adapters/rubicon_spec.js +++ b/test/spec/adapters/rubicon_spec.js @@ -262,7 +262,7 @@ describe('the rubicon adapter', () => { expect(query['alt_size_ids']).to.equal('57,59'); }); - + it('should not send a request and register an error bid if no valid sizes', () => { var sizesBidderRequest = clone(bidderRequest); @@ -277,6 +277,19 @@ describe('the rubicon adapter', () => { expect(bids[0].getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID); }); + + it('should allow a floor override', () => { + + var floorBidderRequest = clone(bidderRequest); + floorBidderRequest.bids[0].params.floor = 2; + + rubiconAdapter.callBids(floorBidderRequest); + + let query = parseQuery(xhr.requests[0].url.split('?')[1]); + + expect(query['rp_floor']).to.equal('2'); + + }); }); @@ -658,4 +671,4 @@ describe('the rubicon adapter', () => { function clone(obj) { return JSON.parse(JSON.stringify(obj)); -} \ No newline at end of file +}