merritt-manifest 0.1.1 → 0.1.2

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: 9cb3e93897e66af0758ee2ad42e5b9b8c0a6bd2c
4
- data.tar.gz: 7a1e0afce2443cc78ad558e1a93882257c7502c5
3
+ metadata.gz: 97265a1be13c6b40971aaa4a05738b1ada70633e
4
+ data.tar.gz: 6a0888f89af7a22b94da963ccfb08e7c10f435f1
5
5
  SHA512:
6
- metadata.gz: 63c2e6d1f168a4f7f046762d72c94b4d7b095ee3ef29d554d245079ddd9fdb6ccc4473fd5adaf174698ddf195e3721c5eea2bbe7130a1a5d956d0b08857c8719
7
- data.tar.gz: 44baf91994e97c54ce4e399cb13be54c7a2556b1f2076ca2fb696e23ae84ebbc7f7937ec3b03bf5e3eb54f712e8a145a220680b82e1d8a435aa7c1645080e6e5
6
+ metadata.gz: c6eda103c0db71f4aac2211dfeb16ff94febe6a5f073aaaa9cba2379a7b8599017e5eb0499922d9cfeeb5a02f47b1bc04b4de524cdf53d1e4eff4cff9806e3f3
7
+ data.tar.gz: cc894aa3b71fec2ce83d9f43a4c6bb56957a21c89afcee2332eeca140ca81fa759638ddea6262693779e6b7834d442a6484cdd6dce8552b36a6f3593d529ddec
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.2 (22 April 2017)
2
+
3
+ - Fixed issue where unknown MIME types would not be written to the manifest (#1)
4
+
1
5
  # 0.1.1 (18 April 2017)
2
6
 
3
7
  - `Merritt::Manifest::Fields::Object::MIME_TYPE` now correctly parses strings as
@@ -5,7 +9,6 @@
5
9
  - **BREAKING CHANGE:** `Merritt::Manifest::DataONE` now uses the standard `file_name`
6
10
  and `mime_type` fields rather than `name` and `type`.
7
11
 
8
-
9
12
  # 0.1.0 (18 April 2017)
10
13
 
11
14
  - Initial release.
@@ -117,7 +117,7 @@ module Merritt
117
117
  def value_from(obj)
118
118
  value = super(obj)
119
119
  return value if value.nil? || value.is_a?(::MIME::Type)
120
- ::MIME::Types[value.to_s].first
120
+ ::MIME::Types[value.to_s].first || value.to_s
121
121
  end
122
122
  end
123
123
  end
@@ -4,7 +4,7 @@ module Merritt
4
4
  NAME = 'merritt-manifest'.freeze
5
5
 
6
6
  # The version of this gem
7
- VERSION = '0.1.1'.freeze
7
+ VERSION = '0.1.2'.freeze
8
8
 
9
9
  # The copyright notice for this gem
10
10
  COPYRIGHT = 'Copyright (c) 2017 The Regents of the University of California'.freeze
data/merritt-manifest.iml CHANGED
@@ -30,7 +30,7 @@
30
30
  <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.10.0, ruby-2.2.5-p319) [gem]" level="application" />
31
31
  <orderEntry type="library" scope="PROVIDED" name="typesafe_enum (v0.1.7, ruby-2.2.5-p319) [gem]" level="application" />
32
32
  <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.2.1, ruby-2.2.5-p319) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="yard (v0.9.8, ruby-2.2.5-p319) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="yard (v0.9.9, ruby-2.2.5-p319) [gem]" level="application" />
34
34
  </component>
35
35
  <component name="RModuleSettingsStorage">
36
36
  <LOAD_PATH number="2" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" />
@@ -50,6 +50,26 @@ module Merritt
50
50
  expect(actual).to eq(expected)
51
51
  end
52
52
  end
53
+
54
+ describe :MIME_TYPE do
55
+ it 'extracts the mime type' do
56
+ mime_type = 'text/html'
57
+ obj = OpenStruct.new(mime_type: mime_type)
58
+ mt_val = ::MIME::Types[mime_type].first
59
+ expect(mt_val).not_to be_nil # just to be sure
60
+ actual = Manifest::Fields::Object::MIME_TYPE.value_from(obj)
61
+ expect(actual).to eq(mt_val.to_s)
62
+ end
63
+
64
+ it 'accepts unknown or garbage types' do
65
+ mime_type = 'I am not a mime type, but whatever'
66
+ obj = OpenStruct.new(mime_type: mime_type)
67
+ mt_val = ::MIME::Types[mime_type].first
68
+ expect(mt_val).to be_nil # just to be sure
69
+ actual = Manifest::Fields::Object::MIME_TYPE.value_from(obj)
70
+ expect(actual).to eq(mime_type)
71
+ end
72
+ end
53
73
  end
54
74
  end
55
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merritt-manifest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types