The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.3 KiB

  1. require 'rails_helper'
  2. RSpec.describe StatusPin, type: :model do
  3. describe 'validations' do
  4. it 'allows pins of own statuses' do
  5. account = Fabricate(:account)
  6. status = Fabricate(:status, account: account)
  7. expect(StatusPin.new(account: account, status: status).save).to be true
  8. end
  9. it 'does not allow pins of statuses by someone else' do
  10. account = Fabricate(:account)
  11. status = Fabricate(:status)
  12. expect(StatusPin.new(account: account, status: status).save).to be false
  13. end
  14. it 'does not allow pins of reblogs' do
  15. account = Fabricate(:account)
  16. status = Fabricate(:status, account: account)
  17. reblog = Fabricate(:status, reblog: status)
  18. expect(StatusPin.new(account: account, status: reblog).save).to be false
  19. end
  20. it 'does not allow pins of private statuses' do
  21. account = Fabricate(:account)
  22. status = Fabricate(:status, account: account, visibility: :private)
  23. expect(StatusPin.new(account: account, status: status).save).to be false
  24. end
  25. it 'does not allow pins of direct statuses' do
  26. account = Fabricate(:account)
  27. status = Fabricate(:status, account: account, visibility: :direct)
  28. expect(StatusPin.new(account: account, status: status).save).to be false
  29. end
  30. end
  31. end