1
0

statuses_cleanup_controller_spec.rb 856 B

123456789101112131415161718192021222324252627
  1. require 'rails_helper'
  2. RSpec.describe StatusesCleanupController, type: :controller do
  3. render_views
  4. before do
  5. @user = Fabricate(:user)
  6. sign_in @user, scope: :user
  7. end
  8. describe "GET #show" do
  9. it "returns http success" do
  10. get :show
  11. expect(response).to have_http_status(200)
  12. end
  13. end
  14. describe 'PUT #update' do
  15. it 'updates the account status cleanup policy' do
  16. put :update, params: { account_statuses_cleanup_policy: { enabled: true, min_status_age: 2.weeks.seconds, keep_direct: false, keep_polls: true } }
  17. expect(response).to redirect_to(statuses_cleanup_path)
  18. expect(@user.account.statuses_cleanup_policy.enabled).to eq true
  19. expect(@user.account.statuses_cleanup_policy.keep_direct).to eq false
  20. expect(@user.account.statuses_cleanup_policy.keep_polls).to eq true
  21. end
  22. end
  23. end