~cytrogen/masto-fe

ref: b9e2eb5184f3f2c92836f6aec68d0500e8de23ae masto-fe/spec/controllers/statuses_cleanup_controller_spec.rb -rw-r--r-- 1.1 KiB
b9e2eb51 — renovate[bot] Update dependency @material-design-icons/svg to v0.14.12 (#26832) 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
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe StatusesCleanupController do
  render_views

  before do
    @user = Fabricate(:user)
    sign_in @user, scope: :user
  end

  describe 'GET #show' do
    before do
      get :show
    end

    it 'returns http success' do
      expect(response).to have_http_status(200)
    end

    it 'returns private cache control headers' do
      expect(response.headers['Cache-Control']).to include('private, no-store')
    end
  end

  describe 'PUT #update' do
    before do
      put :update, params: { account_statuses_cleanup_policy: { enabled: true, min_status_age: 2.weeks.seconds, keep_direct: false, keep_polls: true } }
    end

    it 'updates the account status cleanup policy' do
      expect(@user.account.statuses_cleanup_policy.enabled).to be true
      expect(@user.account.statuses_cleanup_policy.keep_direct).to be false
      expect(@user.account.statuses_cleanup_policy.keep_polls).to be true
    end

    it 'redirects' do
      expect(response).to redirect_to(statuses_cleanup_path)
    end
  end
end