Sha256: f33b9589a66dadc58775ecbdfed8b7e50923b17655e1b228a41760b6e24b4748

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'rails_helper'
  
describe ResourceExportFile do
  fixtures :all
  
  it "should export ncid" do
    manifestation = FactoryBot.create(:manifestation)
    type = IdentifierType.find_or_create_by(name: "ncid")
    identifier = FactoryBot.create(:identifier, identifier_type: type, body: "a11223344")
    manifestation.identifiers << identifier
    export_file = ResourceExportFile.new
    export_file.user = users(:admin)
    export_file.save!
    export_file.export!
    file = export_file.resource_export
    CSV.open(file.path, {headers: true, col_sep: "\t"}).each do |row|
      expect(row).to have_key "ncid"
      if row['manifestation_id'] == identifier.manifestation_id
        expect(row["ncid"]).to eq identifier.body
      end
    end
  end
end

# == Schema Information
#
# Table name: resource_export_files
#
#  id                           :integer          not null, primary key
#  user_id                      :integer
#  resource_export_file_name    :string
#  resource_export_content_type :string
#  resource_export_file_size    :integer
#  resource_export_updated_at   :datetime
#  executed_at                  :datetime
#  created_at                   :datetime
#  updated_at                   :datetime
#

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
enju_nii-0.3.2 spec/models/resource_export_file_spec.rb
enju_nii-0.3.1 spec/models/resource_export_file_spec.rb