import_spec.rb 740 B

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