From bbaf1cff309b74d22e484c412588d28c43f7f572 Mon Sep 17 00:00:00 2001 From: Iain Beeston Date: Wed, 24 Feb 2021 12:14:46 +0000 Subject: [PATCH] Made specs check if/when the xhr script tag is added Before it was ambiguous because the output for the tag was empty. --- spec/bullet/rack_spec.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spec/bullet/rack_spec.rb b/spec/bullet/rack_spec.rb index f12af10e..6d402ad9 100644 --- a/spec/bullet/rack_spec.rb +++ b/spec/bullet/rack_spec.rb @@ -90,7 +90,7 @@ module Bullet before do expect(Bullet).to receive(:notification?).and_return(true) allow(Bullet).to receive(:gather_inline_notifications).and_return('') - allow(middleware).to receive(:xhr_script).and_return('') + allow(middleware).to receive(:xhr_script).and_return('') allow(middleware).to receive(:footer_note).and_return('footer') expect(Bullet).to receive(:perform_out_of_channel_notifications) end @@ -99,9 +99,8 @@ module Bullet expect(Bullet).to receive(:add_footer).exactly(3).times.and_return(true) _, headers, response = middleware.call('Content-Type' => 'text/html') - expect(headers['Content-Length']).to eq((56 + middleware.send(:footer_note).length).to_s) - expect(response.first).to start_with('') - expect(response.first).to include('<') + expect(headers['Content-Length']).to eq((73 + middleware.send(:footer_note).length).to_s) + expect(response).to eq(%w[footer]) end it 'should change response body for html safe string if add_footer is true' do @@ -111,9 +110,8 @@ module Bullet end _, headers, response = middleware.call('Content-Type' => 'text/html') - expect(headers['Content-Length']).to eq((56 + middleware.send(:footer_note).length).to_s) - expect(response.first).to start_with('') - expect(response.first).to include('<') + expect(headers['Content-Length']).to eq((73 + middleware.send(:footer_note).length).to_s) + expect(response).to eq(%w[footer]) end it 'should change response body if console_enabled is true' do