From 9edad844a46bfd2462eaed1b377591331ceac355 Mon Sep 17 00:00:00 2001 From: Pranav Date: Tue, 19 May 2026 17:34:32 -0700 Subject: [PATCH] fix spec --- spec/models/channel/google_play_spec.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/spec/models/channel/google_play_spec.rb b/spec/models/channel/google_play_spec.rb index ef9903473..22c735f29 100644 --- a/spec/models/channel/google_play_spec.rb +++ b/spec/models/channel/google_play_spec.rb @@ -81,7 +81,9 @@ RSpec.describe Channel::GooglePlay do end it 'raises when the API responds with an error' do - stub_request(:get, base_url).to_return(status: 403, body: 'forbidden') + stub_request(:get, base_url) + .with(query: hash_including('maxResults' => '100')) + .to_return(status: 403, body: 'forbidden') expect { channel.fetch_reviews }.to raise_error(/Google Play reviews fetch failed \(403\)/) end @@ -105,15 +107,15 @@ RSpec.describe Channel::GooglePlay do end it 'truncates the reply text to MAX_REPLY_LENGTH' do - long_text = 'a' * 500 - stub_request(:post, url) - .with(body: hash_including('replyText' => 'a' * described_class::MAX_REPLY_LENGTH)) - .to_return(status: 200, body: { result: { lastEdited: { seconds: '1' } } }.to_json, - headers: { 'Content-Type' => 'application/json' }) + stub_request(:post, url).to_return(status: 200, + body: { result: { lastEdited: { seconds: '1' } } }.to_json, + headers: { 'Content-Type' => 'application/json' }) - channel.reply_to_review('REV-1', long_text) - expect(WebMock).to have_requested(:post, url) - .with(body: hash_including('replyText' => 'a' * described_class::MAX_REPLY_LENGTH)) + channel.reply_to_review('REV-1', 'a' * 500) + + expect(WebMock).to(have_requested(:post, url).with do |req| + JSON.parse(req.body)['replyText'].length <= described_class::MAX_REPLY_LENGTH + end) end it 'raises when the API responds with an error' do