1
0

anonymous_cookies_spec.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Anonymous visits' do
  4. around do |example|
  5. old = ActionController::Base.allow_forgery_protection
  6. ActionController::Base.allow_forgery_protection = true
  7. example.run
  8. ActionController::Base.allow_forgery_protection = old
  9. end
  10. describe 'account pages' do
  11. it 'do not set cookies' do
  12. alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
  13. _status = Fabricate(:status, account: alice, text: 'Hello World')
  14. get '/@alice'
  15. expect(response.cookies).to be_empty
  16. end
  17. end
  18. describe 'status pages' do
  19. it 'do not set cookies' do
  20. alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
  21. status = Fabricate(:status, account: alice, text: 'Hello World')
  22. get short_account_status_url(alice, status)
  23. expect(response.cookies).to be_empty
  24. end
  25. end
  26. describe 'the /about page' do
  27. it 'does not set cookies' do
  28. get '/about'
  29. expect(response.cookies).to be_empty
  30. end
  31. end
  32. end