Sha256: 82a1cecdb1b117ce8b173316fd144abd160fefce405d1b448c67ff22881cf988

Contents?: true

Size: 1.63 KB

Versions: 21

Compression:

Stored size: 1.63 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Using the CsvImportDetail models' do
  let(:user) { User.new }
  let(:csv_import) { Zizia::CsvImport.new }
  let(:csv_import_detail) { Zizia::CsvImportDetail.new }
  let(:pre_ingest_work_one) { Zizia::PreIngestWork.new }
  let(:pre_ingest_work_two) { Zizia::PreIngestWork.new }
  let(:pre_ingest_file_one) do
    Zizia::PreIngestFile.new(row: 'some,row',
                             row_number: 1,
                             size: 1000)
  end
  let(:pre_ingest_file_two) do
    Zizia::PreIngestFile.new(row: 'another,row',
                             row_number: 2,
                             size: 2000)
  end

  it 'allows you to create PreIngestFiles that are associated with PreIngestWorks' do
    pre_ingest_work_one.save

    pre_ingest_work_one.pre_ingest_files << pre_ingest_file_one
    pre_ingest_work_one.pre_ingest_files << pre_ingest_file_two

    expect(pre_ingest_work_one.pre_ingest_files.length).to eq(2)
  end

  it 'allows you to associate PreIngestWorks & Files with a CsvImportDetail' do
    user.save
    csv_import.user = user
    csv_import.save!
    csv_import_detail.csv_import = csv_import
    csv_import_detail.save!

    pre_ingest_work_one.pre_ingest_files << pre_ingest_file_one
    pre_ingest_work_one.pre_ingest_files << pre_ingest_file_two
    csv_import_detail.pre_ingest_works << pre_ingest_work_one
    csv_import_detail.pre_ingest_works << pre_ingest_work_two

    expect(csv_import_detail.pre_ingest_files.length).to eq(2)
    expect(csv_import_detail.pre_ingest_works.length).to eq(2)

    expect(csv_import_detail.total_size).to eq(3000)
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
zizia-6.0.1 spec/integration/csv_import_detail_spec.rb
zizia-6.0.0 spec/integration/csv_import_detail_spec.rb
zizia-5.5.0 spec/integration/csv_import_detail_spec.rb
zizia-5.4.0 spec/integration/csv_import_detail_spec.rb
zizia-5.3.0 spec/integration/csv_import_detail_spec.rb
zizia-5.2.0 spec/integration/csv_import_detail_spec.rb
zizia-5.1.0 spec/integration/csv_import_detail_spec.rb
zizia-5.0.1 spec/integration/csv_import_detail_spec.rb
zizia-5.0.0 spec/integration/csv_import_detail_spec.rb
zizia-4.6.0.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.5.4.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.5.3.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.5.2.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.5.1.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.4.1.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.4.0.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.3.1.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.2.0.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.1.0.alpha.01 spec/integration/csv_import_detail_spec.rb
zizia-4.0.4.alpha.01 spec/integration/csv_import_detail_spec.rb