From be2997602c63ec61d5bb0a804f1376d8c1045dca Mon Sep 17 00:00:00 2001 From: Huda Khan Date: Thu, 2 Nov 2023 22:50:09 -0600 Subject: [PATCH] adding test --- spec/models/projection_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/models/projection_spec.rb b/spec/models/projection_spec.rb index a4814885..a8802bda 100644 --- a/spec/models/projection_spec.rb +++ b/spec/models/projection_spec.rb @@ -20,7 +20,7 @@ end end - describe '#tile_dimensions' do + describe '#tiledimensions' do subject { instance.send(:tile_dimensions) } context "for an unrestricted image" do @@ -112,6 +112,18 @@ expect(http_client).to have_received(:get).with(%r{/full/max/0/default.jpg}) end end + + context "best fit size" do + let(:options) { { size: '!850,700', region: 'full' } } + + it 'returns original size when requested dimensions are larger' do + allow(HTTP).to receive(:use) + .and_return(http_client) + allow(http_client).to receive(:get).and_return(double(body: nil)) + subject.response + expect(http_client).to have_received(:get).with(%r{/full/!800,600/0/default.jpg}) + end + end end context 'for a restricted image' do