logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

import_spec.rb (699B)


  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