summaryrefslogtreecommitdiff
path: root/spec/models/bulk_imports/export_upload_spec.rb
blob: d9ae41af0db4f6ec5451a1881bb064ed13f2797f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BulkImports::ExportUpload do
  subject { described_class.new(export: create(:bulk_import_export)) }

  describe 'associations' do
    it { is_expected.to belong_to(:export) }
  end

  it 'stores export file' do
    method = 'export_file'
    filename = 'labels.ndjson.gz'

    subject.public_send("#{method}=", fixture_file_upload("spec/fixtures/bulk_imports/gz/#{filename}"))
    subject.save!

    url = "/uploads/-/system/bulk_imports/export_upload/export_file/#{subject.id}/#{filename}"

    expect(subject.public_send(method).url).to eq(url)
  end
end