闭社主体 forked from https://github.com/tootsuite/mastodon
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.

24 lines
699 B

  1. require 'rails_helper'
  2. RSpec.describe Import, type: :model do
  3. let (:account) { Fabricate(:account) }
  4. let (:type) { 'following' }
  5. let (:data) { attachment_fixture('imports.txt') }
  6. describe 'validations' do
  7. it 'has a valid parameters' do
  8. import = Import.create(account: account, type: type, data: data)
  9. expect(import).to be_valid
  10. end
  11. it 'is invalid without an type' do
  12. import = Import.create(account: account, data: data)
  13. expect(import).to model_have_error_on_field(:type)
  14. end
  15. it 'is invalid without a data' do
  16. import = Import.create(account: account, type: type)
  17. expect(import).to model_have_error_on_field(:data)
  18. end
  19. end
  20. end