research_metadata 1.1.2 → 2.0.0

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
  SHA1:
3
- metadata.gz: 7c8791a6102b1a09b52ca6fc0860c5151b08d593
4
- data.tar.gz: 9f683d6ea78326b1808d1b01f8c7a6cc354d06e4
3
+ metadata.gz: 7861dd7bacfce9d729ef20167e9864a8b15d6143
4
+ data.tar.gz: 920b37ed1c76a2a20eed3299cd73767bc90b7511
5
5
  SHA512:
6
- metadata.gz: 0a650d857b31760ad85cef4585d4904cd575d73207e3b3650b6db8d3a36f408ed6e84b6005f2dc1a51b0624932f1de523b159ae40e291a4b27d56bb1d74bd513
7
- data.tar.gz: 6382e9a4e827654f41537917444a2c2fa6c143b3ffbafd5e6ccb15a88655fe9b5c2ac49b291369d8528194c5e6cf9eb443b8710dcedff598550071d46324bb54
6
+ metadata.gz: e8f6fcfd79df3cef1b04b6b311037aef402b4428628e55f42c1ace8c6891f113b7b5e361b76d79aa6822628193c366e8c30cf9aec6328dd15cfcfbc1e0edc71f
7
+ data.tar.gz: 9d0fe4acd36a77025ef170efc8584508fba4fbf272f973e649a10742d719112d7ec59bd142f8f458f84d808aebbb41fe19e1c36e2e1b5efa30889baad714a127
data/CHANGELOG.md CHANGED
@@ -2,7 +2,13 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
- ## Unreleased
5
+ ## 2.0.0 2017-12-20
6
+ ### Added
7
+ - Research output - translated title.
8
+ - Testing against known live data.
9
+
10
+ ### Changed
11
+ - For Pure API 59.
6
12
 
7
13
  ## 1.1.2 2017-07-12
8
14
  ### Fixed
data/README.md CHANGED
@@ -5,9 +5,7 @@ Metadata extraction from the Pure Research Information System and transformation
5
5
  ## Status
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/research_metadata.svg)](https://badge.fury.io/rb/research_metadata)
8
- [![Build Status](https://semaphoreci.com/api/v1/aalbinclark/research_metadata/branches/master/badge.svg)](https://semaphoreci.com/aalbinclark/research_metadata)
9
- [![Code Climate](https://codeclimate.com/github/lulibrary/research_metadata/badges/gpa.svg)](https://codeclimate.com/github/lulibrary/research_metadata)
10
- [![Dependency Status](https://www.versioneye.com/user/projects/5899d1be1e07ae0048c8e4c6/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/5899d1be1e07ae0048c8e4c6)
8
+ [![Maintainability](https://api.codeclimate.com/v1/badges/26080a93183c7fcdf525/maintainability)](https://codeclimate.com/github/lulibrary/research_metadata/maintainability)
11
9
 
12
10
  ## Installation
13
11
 
@@ -30,24 +28,17 @@ Or install it yourself as:
30
28
  Create a hash for passing to a transformer.
31
29
 
32
30
  ```ruby
33
- # Pure host with authentication.
34
31
  config = {
35
- url: ENV['PURE_URL'],
36
- username: ENV['PURE_USERNAME'],
37
- password: ENV['PURE_PASSWORD']
38
- }
39
- ```
40
-
41
- ```ruby
42
- # Pure host without authentication.
43
- config = {
44
- url: ENV['PURE_URL']
32
+ url: 'https://YOUR_HOST/ws/api/59',
33
+ username: 'YOUR_USERNAME',
34
+ password: 'YOUR_PASSWORD',
35
+ api_key: 'YOUR_API_KEY'
45
36
  }
46
37
  ```
47
38
 
48
39
  ### Transformation
49
40
 
50
- Create a metadata transformer for a Pure dataset.
41
+ Configure a transformer for a Pure dataset.
51
42
 
52
43
  ```ruby
53
44
  transformer = ResearchMetadata::Transformer::Dataset.new config
@@ -56,7 +47,7 @@ transformer = ResearchMetadata::Transformer::Dataset.new config
56
47
  Give it a Pure identifier and a DOI...
57
48
 
58
49
  ```ruby
59
- metadata = transformer.transform uuid: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx',
50
+ metadata = transformer.transform id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx',
60
51
  doi: '10.1234/foo/bar/1'
61
52
  ```
62
53
 
@@ -8,9 +8,10 @@ module ResearchMetadata
8
8
  class Dataset
9
9
 
10
10
  # @param config [Hash]
11
- # @option config [String] :url The URL of the Pure host.
12
- # @option config [String] :username The username of the Pure host account.
13
- # @option config [String] :password The password of the Pure host account.
11
+ # @option config [String] :url URL of the Pure host
12
+ # @option config [String] :username Username of the Pure host account
13
+ # @option config [String] :password Password of the Pure host account
14
+ # @option config [String] :api_key API key of the Pure host account
14
15
  def initialize(config)
15
16
  @config = config
16
17
  @dataset_extractor = Puree::Extractor::Dataset.new config
@@ -19,11 +20,10 @@ module ResearchMetadata
19
20
  # Dataset transformation
20
21
  #
21
22
  # @param id [String]
22
- # @param uuid [String]
23
23
  # @param doi [String]
24
24
  # @return [String, nil]
25
- def transform(id: nil, uuid: nil, doi: nil)
26
- @dataset = extract uuid: uuid, id: id
25
+ def transform(id:, doi:)
26
+ @dataset = @dataset_extractor.find id
27
27
  return nil if !@dataset
28
28
  person_o = person
29
29
  file_o = file
@@ -36,11 +36,11 @@ module ResearchMetadata
36
36
  subjects: subjects,
37
37
  contributors: person_o['contributor'],
38
38
  dates: dates,
39
- language: language,
39
+ # language: language,
40
40
  resource_type: resource_type,
41
41
  related_identifiers: related_identifiers,
42
- sizes: sizes(file_o),
43
- formats: formats(file_o),
42
+ # sizes: sizes(file_o),
43
+ # formats: formats(file_o),
44
44
  rights_list: rights_list(file_o),
45
45
  descriptions: description,
46
46
  geo_locations: spatial
@@ -50,13 +50,13 @@ module ResearchMetadata
50
50
 
51
51
  private
52
52
 
53
- def sizes(files)
54
- files.map { |i| "#{i.size} B" }
55
- end
53
+ # def sizes(files)
54
+ # files.map { |i| "#{i.size} B" }
55
+ # end
56
56
 
57
- def formats(files)
58
- files.map { |i| i.mime }
59
- end
57
+ # def formats(files)
58
+ # files.map { |i| i.mime }
59
+ # end
60
60
 
61
61
  def rights_list(files)
62
62
  arr = []
@@ -115,14 +115,6 @@ module ResearchMetadata
115
115
  end
116
116
  end
117
117
 
118
- def extract(uuid: nil, id: nil)
119
- if !uuid.nil?
120
- return @dataset_extractor.find uuid: uuid
121
- else
122
- return @dataset_extractor.find id: id
123
- end
124
- end
125
-
126
118
  def file
127
119
  @dataset.files
128
120
  end
@@ -131,9 +123,9 @@ module ResearchMetadata
131
123
  ::Datacite::Mapping::Identifier.new(value: doi)
132
124
  end
133
125
 
134
- def language
135
- @dataset.locale
136
- end
126
+ # def language
127
+ # @dataset.language
128
+ # end
137
129
 
138
130
  def name_identifier_orcid(person)
139
131
  name_identifier = nil
@@ -170,7 +162,7 @@ module ResearchMetadata
170
162
  if human
171
163
  if individual.uuid
172
164
  person_extractor = Puree::Extractor::Person.new @config
173
- person = person_extractor.find uuid: individual.uuid
165
+ person = person_extractor.find individual.uuid
174
166
  if person
175
167
  identifier = name_identifier_orcid person
176
168
  human.identifier = identifier if identifier
@@ -195,21 +187,21 @@ module ResearchMetadata
195
187
  end
196
188
 
197
189
  def publisher
198
- @dataset.publisher
190
+ @dataset.publisher.name
199
191
  end
200
192
 
201
193
  def related_identifiers
202
- publications = @dataset.publications
194
+ research_outputs = @dataset.research_outputs
203
195
  data = []
204
- publications.each do |i|
196
+ research_outputs.each do |i|
205
197
  # Skip as the relationship cannot currently be determined
206
198
  next if i.type === 'Dataset'
207
199
 
208
- publication_extractor = Puree::Extractor::Publication.new @config
209
- pub = publication_extractor.find uuid: i.uuid
200
+ research_output_extractor = Puree::Extractor::ResearchOutput.new @config
201
+ research_output = research_output_extractor.find i.uuid
210
202
 
211
203
  # Restrict to those with a DOI
212
- doi = pub.doi if pub.methods.include? :doi
204
+ doi = research_output.doi if research_output.methods.include? :doi
213
205
 
214
206
  if doi
215
207
  doi_part_to_remove = 'http://dx.doi.org/'
@@ -2,30 +2,31 @@ module ResearchMetadata
2
2
 
3
3
  module Transformer
4
4
 
5
- # Extracts publication metadata from the Pure Research Information System
5
+ # Extracts research output metadata from the Pure Research Information System
6
6
  # and converts it into the DataCite format.
7
7
  # For text-based resources.
8
+ # @note Do not use directly.
8
9
  #
9
- class Publication
10
+ class ResearchOutput
10
11
 
11
12
  # @param config [Hash]
12
- # @option config [String] :url The URL of the Pure host.
13
- # @option config [String] :username The username of the Pure host account.
14
- # @option config [String] :password The password of the Pure host account.
13
+ # @option config [String] :url URL of the Pure host
14
+ # @option config [String] :username Username of the Pure host account
15
+ # @option config [String] :password Password of the Pure host account
16
+ # @option config [String] :api_key API key of the Pure host account
15
17
  def initialize(config)
16
18
  @config = config
17
- @publication_extractor = Puree::Extractor::Publication.new config
19
+ @research_output_extractor = Puree::Extractor::ResearchOutput.new config
18
20
  end
19
21
 
20
- # Publication transformation
22
+ # Research output transformation
21
23
  #
22
24
  # @param id [String]
23
- # @param uuid [String]
24
25
  # @param doi [String]
25
26
  # @return [String, nil]
26
- def transform(id: nil, uuid: nil, doi: nil)
27
- @publication = extract uuid: uuid, id: id
28
- return nil if !@publication
27
+ def transform(id:, doi:)
28
+ @research_output = @research_output_extractor.find id
29
+ return nil if !@research_output
29
30
  person_o = person
30
31
  file_o = file
31
32
  resource = ::Datacite::Mapping::Resource.new(
@@ -75,7 +76,7 @@ module ResearchMetadata
75
76
  end
76
77
 
77
78
  def description
78
- desc = @publication.description
79
+ desc = @research_output.description
79
80
  if desc
80
81
  d = ::Datacite::Mapping::Description.new value: desc,
81
82
  type: ::Datacite::Mapping::DescriptionType::ABSTRACT
@@ -85,16 +86,8 @@ module ResearchMetadata
85
86
  end
86
87
  end
87
88
 
88
- def extract(uuid: nil, id: nil)
89
- if !uuid.nil?
90
- return @publication_extractor.find uuid: uuid
91
- else
92
- return @publication_extractor.find id: id
93
- end
94
- end
95
-
96
89
  def file
97
- @publication.files
90
+ @research_output.files
98
91
  end
99
92
 
100
93
  def identifier(doi)
@@ -102,7 +95,7 @@ module ResearchMetadata
102
95
  end
103
96
 
104
97
  def language
105
- @publication.locale
98
+ @research_output.language
106
99
  end
107
100
 
108
101
  def name_identifier_orcid(person)
@@ -120,9 +113,9 @@ module ResearchMetadata
120
113
  o['creator'] = []
121
114
  o['contributor'] = []
122
115
  all_persons = []
123
- all_persons << @publication.persons_internal
124
- all_persons << @publication.persons_external
125
- all_persons << @publication.persons_other
116
+ all_persons << @research_output.persons_internal
117
+ all_persons << @research_output.persons_external
118
+ all_persons << @research_output.persons_other
126
119
  all_persons.each do |person_type|
127
120
  person_type.each do |individual|
128
121
  pure_role =individual.role.gsub(/\s+/, '')
@@ -142,7 +135,7 @@ module ResearchMetadata
142
135
  if human
143
136
  if individual.uuid
144
137
  person_extractor = Puree::Extractor::Person.new @config
145
- person = person_extractor.find uuid: individual.uuid
138
+ person = person_extractor.find individual.uuid
146
139
  if person
147
140
  identifier = name_identifier_orcid person
148
141
  human.identifier = identifier if identifier
@@ -163,7 +156,7 @@ module ResearchMetadata
163
156
  end
164
157
 
165
158
  def publication_year
166
- @publication.statuses.each do |i|
159
+ @research_output.publication_statuses.each do |i|
167
160
  if i.stage === 'Published' || i.stage === 'Unpublished'
168
161
  return i.date.year
169
162
  end
@@ -171,10 +164,6 @@ module ResearchMetadata
171
164
  nil
172
165
  end
173
166
 
174
- def publisher
175
- @publication.publisher || 'Publisher unspecified'
176
- end
177
-
178
167
  def resource_type
179
168
  ::Datacite::Mapping::ResourceType.new(
180
169
  resource_type_general: ::Datacite::Mapping::ResourceTypeGeneral::TEXT,
@@ -183,18 +172,23 @@ module ResearchMetadata
183
172
  end
184
173
 
185
174
  def subjects
186
- @publication.keywords.map { |i| ::Datacite::Mapping::Subject.new value: i }
175
+ @research_output.keywords.map { |i| ::Datacite::Mapping::Subject.new value: i }
187
176
  end
188
177
 
189
178
  def titles
190
179
  arr = []
191
- title = ::Datacite::Mapping::Title.new value: @publication.title
180
+ title = ::Datacite::Mapping::Title.new value: @research_output.title
192
181
  arr << title
193
- subtitle = @publication.subtitle
182
+ subtitle = @research_output.subtitle
194
183
  if subtitle
195
184
  arr << ::Datacite::Mapping::Title.new(value: subtitle,
196
185
  type: ::Datacite::Mapping::TitleType::SUBTITLE)
197
186
  end
187
+ translated_title = @research_output.translated_title
188
+ if translated_title
189
+ arr << ::Datacite::Mapping::Title.new(value: translated_title,
190
+ type: ::Datacite::Mapping::TitleType::TRANSLATED_TITLE)
191
+ end
198
192
  arr
199
193
  end
200
194
 
@@ -2,25 +2,26 @@ module ResearchMetadata
2
2
 
3
3
  module Transformer
4
4
 
5
- # Extracts publication metadata from the Pure Research Information System
5
+ # Extracts research output metadata from the Pure Research Information System
6
6
  # and converts it into the DataCite format. Usage is for theses
7
7
  # (doctoral and master's).
8
8
  #
9
- class Thesis < ResearchMetadata::Transformer::Publication
9
+ class Thesis < ResearchMetadata::Transformer::ResearchOutput
10
10
 
11
11
  # @param config [Hash]
12
- # @option config [String] :url The URL of the Pure host.
13
- # @option config [String] :username The username of the Pure host account.
14
- # @option config [String] :password The password of the Pure host account.
12
+ # @option config [String] :url URL of the Pure host
13
+ # @option config [String] :username Username of the Pure host account
14
+ # @option config [String] :password Password of the Pure host account
15
+ # @option config [String] :api_key API key of the Pure host account
15
16
  def initialize(config)
16
17
  @config = config
17
- @publication_extractor = Puree::Extractor::Thesis.new config
18
+ @research_output_extractor = Puree::Extractor::Thesis.new config
18
19
  end
19
20
 
20
21
  private
21
22
 
22
23
  def pages
23
- count = @publication.pages
24
+ count = @research_output.pages
24
25
  if count && count > 0
25
26
  return "#{count} pages"
26
27
  else
@@ -28,6 +29,10 @@ module ResearchMetadata
28
29
  end
29
30
  end
30
31
 
32
+ def publisher
33
+ @research_output.publisher.name || 'Publisher unspecified'
34
+ end
35
+
31
36
  def sizes(files)
32
37
  arr = files.map { |i| "#{i.size} B" }
33
38
  arr << pages if pages
@@ -1,5 +1,5 @@
1
1
  module ResearchMetadata
2
2
  # Semantic version number
3
3
  #
4
- VERSION = "1.1.2"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  require 'puree'
2
2
  require 'datacite/mapping'
3
3
  require 'research_metadata/transformer/dataset'
4
- require 'research_metadata/transformer/publication'
4
+ require 'research_metadata/transformer/research_output'
5
5
  require 'research_metadata/transformer/thesis'
6
6
  require 'research_metadata/version'
7
7
 
@@ -4,23 +4,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'research_metadata/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "research_metadata"
7
+ spec.name = 'research_metadata'
8
8
  spec.version = ResearchMetadata::VERSION
9
- spec.authors = ["Adrian Albin-Clark"]
10
- spec.email = ["a.albin-clark@lancaster.ac.uk"]
9
+ spec.authors = 'Adrian Albin-Clark'
10
+ spec.email = 'a.albin-clark@lancaster.ac.uk'
11
11
  spec.summary = %q{Metadata extraction from the Pure Research Information System and transformation of the metadata into the DataCite format.}
12
- spec.homepage = "https://github.com/lulibrary/research_metadata"
13
- spec.license = "MIT"
12
+ spec.homepage = 'https://github.com/lulibrary/research_metadata'
13
+ spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
19
19
 
20
20
  spec.required_ruby_version = '~> 2.1'
21
21
 
22
- spec.add_runtime_dependency "puree", "~> 1.2.0"
23
- spec.add_runtime_dependency "datacite-mapping", "~> 0.2.5"
22
+ spec.add_runtime_dependency 'puree', '~> 2.0'
23
+ spec.add_runtime_dependency 'datacite-mapping', '~> 0.2.5'
24
24
 
25
- spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency 'minitest-reporters', '~> 1.1'
26
26
  end
@@ -0,0 +1,17 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/reporters'
3
+ Minitest::Reporters.use!
4
+
5
+ lib = File.expand_path('../../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib)
7
+
8
+ require 'research_metadata'
9
+
10
+ def config
11
+ {
12
+ url: ENV['PURE_URL_TEST_59'],
13
+ username: ENV['PURE_USERNAME'],
14
+ password: ENV['PURE_PASSWORD'],
15
+ api_key: ENV['PURE_API_KEY']
16
+ }
17
+ end
@@ -0,0 +1,25 @@
1
+ require 'test_helper'
2
+
3
+ class TestTransformerDataset < Minitest::Test
4
+
5
+ def transformer
6
+ ResearchMetadata::Transformer::Dataset.new config
7
+ end
8
+
9
+ def test_transformer
10
+ assert_instance_of ResearchMetadata::Transformer::Dataset, transformer
11
+ end
12
+
13
+ def test_transform
14
+ # The 2014 Ebola virus disease outbreak in West Africa
15
+ id = 'b050f4b5-e272-4914-8cac-3bdc1e673c58'
16
+
17
+ metadata = transformer.transform id: id,
18
+ doi: '10.1234/foo/bar/1'
19
+
20
+ # puts metadata
21
+
22
+ assert_equal true, metadata.downcase.start_with?('<resource')
23
+ end
24
+
25
+ end
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+
3
+ class TestTransformerThesis < Minitest::Test
4
+
5
+ def transformer
6
+ ResearchMetadata::Transformer::Thesis.new config
7
+ end
8
+
9
+ def test_transformer
10
+ assert_instance_of ResearchMetadata::Transformer::Thesis, transformer
11
+ end
12
+
13
+ def test_transform_1
14
+ # Multimodalita e 'city branding'
15
+ id = '376173c0-fd7a-4d63-93d3-3f2e58e8dc01'
16
+
17
+ metadata = transformer.transform id: id,
18
+ doi: '10.1234/foo/bar/1'
19
+
20
+ # puts metadata
21
+
22
+ assert_equal true, metadata.downcase.start_with?('<resource')
23
+ end
24
+
25
+ def test_transform_2
26
+ # Nanoscale imaging and characterisation of Amyloid-β
27
+ id ='9d3ad4d1-3d46-4551-9139-f783fd4e5123'
28
+
29
+ metadata = transformer.transform id: id,
30
+ doi: '10.1234/foo/bar/1'
31
+
32
+ # puts metadata
33
+
34
+ assert_equal true, metadata.downcase.start_with?('<resource')
35
+ end
36
+
37
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: research_metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Albin-Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-12 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puree
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.0
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: datacite-mapping
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,22 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.2.5
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: minitest-reporters
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.1'
55
55
  description:
56
- email:
57
- - a.albin-clark@lancaster.ac.uk
56
+ email: a.albin-clark@lancaster.ac.uk
58
57
  executables: []
59
58
  extensions: []
60
59
  extra_rdoc_files: []
@@ -67,13 +66,14 @@ files:
67
66
  - Rakefile
68
67
  - lib/research_metadata.rb
69
68
  - lib/research_metadata/transformer/dataset.rb
70
- - lib/research_metadata/transformer/publication.rb
69
+ - lib/research_metadata/transformer/research_output.rb
71
70
  - lib/research_metadata/transformer/thesis.rb
72
71
  - lib/research_metadata/transformer/transformer.rb
73
72
  - lib/research_metadata/version.rb
74
73
  - research_metadata.gemspec
75
- - spec/spec_helper.rb
76
- - spec/transformer/dataset_spec.rb
74
+ - test/test_helper.rb
75
+ - test/transformer/dataset_test.rb
76
+ - test/transformer/thesis_test.rb
77
77
  homepage: https://github.com/lulibrary/research_metadata
78
78
  licenses:
79
79
  - MIT
@@ -100,5 +100,6 @@ specification_version: 4
100
100
  summary: Metadata extraction from the Pure Research Information System and transformation
101
101
  of the metadata into the DataCite format.
102
102
  test_files:
103
- - spec/spec_helper.rb
104
- - spec/transformer/dataset_spec.rb
103
+ - test/test_helper.rb
104
+ - test/transformer/dataset_test.rb
105
+ - test/transformer/thesis_test.rb
data/spec/spec_helper.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'puree'
2
- require 'datacite/mapping'
3
- require 'research_metadata/transformer/dataset'
4
- require 'research_metadata/version'
@@ -1,37 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Dataset' do
4
-
5
- def setup
6
- @config = {
7
- url: ENV['PURE_URL'],
8
- username: ENV['PURE_USERNAME'],
9
- password: ENV['PURE_PASSWORD']
10
- }
11
- @t = ResearchMetadata::Transformer::Dataset.new @config
12
- end
13
-
14
- it '#new' do
15
- setup
16
- t = ResearchMetadata::Transformer::Dataset.new @config
17
- expect(t).to be_a ResearchMetadata::Transformer::Dataset
18
- end
19
-
20
- describe 'data transformation' do
21
- before(:all) do
22
- setup
23
- end
24
-
25
- it '#transform with random UUID' do
26
- c = Puree::Extractor::Collection.new resource: :dataset,
27
- config: @config
28
- res = c.random_resource
29
- metadata = @t.transform uuid: res.uuid,
30
- doi: '10.1234/foo/bar/1'
31
- is_xml = metadata.downcase.start_with?('<resource')
32
- expect(is_xml).to match(true)
33
- end
34
-
35
- end
36
-
37
- end