import_spec.rb 699 B

123456789101112131415161718192021222324
  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