From 4b6a47be4836acd810a48a1f0a7c8d5c9b67f083 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 6 Feb 2020 11:56:54 -0500 Subject: [PATCH] DEV: do not persist force_custom_user_agent_hosts setting Followup to f029e2 --- lib/oneboxer.rb | 2 +- spec/components/oneboxer_spec.rb | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb index 0c2e74f6995..80b3085933b 100644 --- a/lib/oneboxer.rb +++ b/lib/oneboxer.rb @@ -31,7 +31,7 @@ module Oneboxer end def self.force_custom_user_agent_hosts - @force_custom_user_agent_hosts ||= SiteSetting.force_custom_user_agent_hosts.split('|') + SiteSetting.force_custom_user_agent_hosts.split('|') end def self.allowed_post_types diff --git a/spec/components/oneboxer_spec.rb b/spec/components/oneboxer_spec.rb index 520825d0f1d..c5bc2dca861 100644 --- a/spec/components/oneboxer_spec.rb +++ b/spec/components/oneboxer_spec.rb @@ -3,10 +3,6 @@ require 'rails_helper' describe Oneboxer do - before do - SiteSetting.force_custom_user_agent_hosts = "http://codepen.io|https://video.discourse.org/" - end - it "returns blank string for an invalid onebox" do stub_request(:head, "http://boom.com") stub_request(:get, "http://boom.com").to_return(body: "") @@ -174,6 +170,7 @@ describe Oneboxer do end it "uses the Onebox custom user agent on specified hosts" do + SiteSetting.force_custom_user_agent_hosts = "http://codepen.io|https://video.discourse.org/" url = 'https://video.discourse.org/presentation.mp4' stub_request(:head, url).to_return(status: 403, body: "", headers: {})