discourse/plugins/discourse-unsupported-browser/spec/middleware/anonymous_cache_spec.rb
Dan Ungureanu c85018cdfd
Improve support for old browsers (#9515)
* FEATURE: Improve crawler view

* FIX: Make lazyYT crawler-friendly

* DEV: Rename discourse-internet-explorer to discourse-unsupported-browser

* DEV: Detect more unsupported browsers

Follow-up to 4eebbd2212.

* FIX: Hide browser update notice in print view
2020-04-29 21:40:21 +03:00

27 lines
662 B
Ruby

# frozen_string_literal: true
require "rails_helper"
describe Middleware::AnonymousCache::Helper do
def env(opts = {})
{
"HTTP_HOST" => "http://test.com",
"REQUEST_URI" => "/path?bla=1",
"REQUEST_METHOD" => "GET",
"rack.input" => ""
}.merge(opts)
end
def new_helper(opts = {})
Middleware::AnonymousCache::Helper.new(env(opts))
end
it "includes ie in cache key" do
helper = new_helper
expect(helper.cache_key).to include("ie=false")
helper = new_helper("HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko")
expect(helper.cache_key).to include("ie=true")
end
end