~cytrogen/masto-fe

ref: e754083e8a33778b5dd8d43efc5604ed50efb0e4 masto-fe/spec/requests/anonymous_cookies_spec.rb -rw-r--r-- 1.0 KiB
e754083e — Eugen Rochko Fix unmatched quotes and prefixes causing search to fail (#26701) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true

require 'rails_helper'

context 'when visited anonymously' do
  around do |example|
    old = ActionController::Base.allow_forgery_protection
    ActionController::Base.allow_forgery_protection = true

    example.run

    ActionController::Base.allow_forgery_protection = old
  end

  describe 'account pages' do
    it 'do not set cookies' do
      alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
      _status = Fabricate(:status, account: alice, text: 'Hello World')

      get '/@alice'

      expect(response.cookies).to be_empty
    end
  end

  describe 'status pages' do
    it 'do not set cookies' do
      alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
      status = Fabricate(:status, account: alice, text: 'Hello World')

      get short_account_status_url(alice, status)

      expect(response.cookies).to be_empty
    end
  end

  describe 'the /about page' do
    it 'does not set cookies' do
      get '/about'

      expect(response.cookies).to be_empty
    end
  end
end