zizia 2.1.0.alpha.06 → 2.1.0.alpha.07

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03f0d7edfa32894dcbbbca57b5c6ecee005e57a41e90c81edaf7f012ea4769c4
4
- data.tar.gz: 1c3a2332eb06a562f1954b598551a88f1b24bf1c45afe6e5a846738a0a537697
3
+ metadata.gz: c78e4790d57deee047c384436ceea43c4ff56dc93307adcd24bc0b34b0f6dcc5
4
+ data.tar.gz: 79a5c8be373e2e30093c15cc08c9e7661a9c5286b878341d44572227466b7288
5
5
  SHA512:
6
- metadata.gz: 2c26abb5426d5db325f47dfe5b5399f6f9543b41f048b61d4d8e8ce641428cac6782c3f9f266ec8a0ee20f28c9abffc9cda7d674d42e55fc405b6666844d442e
7
- data.tar.gz: 5586e21dc4c646af501a28ec0f96d8c11a2ab0dff1710d47b17865d9c9d10733b849de2c6308176ad1985d839a8cb988dd5ebfaf497df305f45e69275d856859
6
+ metadata.gz: c73583b3b12b5688e06ba3d305a4ce644761c279f1b8647965d35fc09086cfd8051756c930ee0b38469451ee2ff3d99217470ff4819fcb3911cb84ecaef3507a
7
+ data.tar.gz: 43882530f5ecdfc1c4e8a45c642436116a4fa81c537ba04d820f3ee46def8fc3d228f8cc446c0fd0b3800cab7e30b72f693696b3633e259b162b1e2459897b0b
@@ -12,11 +12,11 @@ module Zizia
12
12
 
13
13
  # The directory where the csv manifest will be stored.
14
14
  def store_dir
15
- configured_upload_path + "#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
15
+ Rails.root.join('tmp', 'csv_uploads')
16
16
  end
17
17
 
18
18
  def cache_dir
19
- configured_cache_path + "#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
19
+ Rails.root.join('tmp', 'csv_uploads_cache')
20
20
  end
21
21
 
22
22
  # Add a white list of extensions which are allowed to be uploaded.
@@ -46,21 +46,5 @@ module Zizia
46
46
  @validator = CsvManifestValidator.new(self)
47
47
  @validator.validate
48
48
  end
49
-
50
- def configured_upload_path
51
- ENV['CSV_MANIFESTS_PATH'] || base_path_uploads + 'csv_uploads'
52
- end
53
-
54
- def configured_cache_path
55
- ENV['CSV_MANIFESTS_CACHE_PATH'] || base_path_cache + 'csv_uploads/cache'
56
- end
57
-
58
- def base_path_uploads
59
- ENV['TRAVIS'] ? Rails.root : Hyrax.config.upload_path.call
60
- end
61
-
62
- def base_path_cache
63
- ENV['TRAVIS'] ? Rails.root : Hyrax.config.cache_path.call
64
- end
65
49
  end
66
50
  end
data/lib/zizia/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zizia
4
- VERSION = '2.1.0.alpha.06'
4
+ VERSION = '2.1.0.alpha.07'
5
5
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Zizia::CsvManifestUploader, type: :model do
5
+ subject(:csv_uploader) { described_class.new }
6
+
7
+ it 'has a a store dir' do
8
+ expect(csv_uploader.store_dir.to_s).to match(/uploads/)
9
+ end
10
+
11
+ it 'has a cache dir' do
12
+ expect(csv_uploader.cache_dir.to_s).to match(/cache/)
13
+ end
14
+
15
+ it 'has an extension whitelist' do
16
+ expect(csv_uploader.extension_whitelist).to eq(%w[csv])
17
+ end
18
+
19
+ it 'returns an empty array if the validator has no errors' do
20
+ expect(csv_uploader.errors).to eq([])
21
+ end
22
+
23
+ it 'has warnings' do
24
+ expect(csv_uploader.warnings).to eq([])
25
+ end
26
+
27
+ it 'has records' do
28
+ expect(csv_uploader.records).to eq(0)
29
+ end
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zizia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.alpha.06
4
+ version: 2.1.0.alpha.07
5
5
  platform: ruby
6
6
  authors:
7
7
  - Data Curation Experts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-06 00:00:00.000000000 Z
11
+ date: 2019-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora
@@ -456,6 +456,7 @@ files:
456
456
  - spec/support/hyrax/basic_metadata.rb
457
457
  - spec/support/hyrax/core_metadata.rb
458
458
  - spec/support/shared_contexts/with_work_type.rb
459
+ - spec/uploaders/csv_manifest_uploader_spec.rb
459
460
  - spec/views/zizia/importer_documentation/guide.html.erb_spec.rb
460
461
  - spec/zizia/csv_format_validator_spec.rb
461
462
  - spec/zizia/csv_parser_spec.rb