blacklight 6.7.0 → 6.7.1

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: 8d9d1db7c5b929bb935e9ce41c06af1c4707856c
4
- data.tar.gz: 328b4f96a2f73164e0ee3a8b298157ee4025e9ad
3
+ metadata.gz: 7017f77770714ea07e09285f82825f8e96bb0df4
4
+ data.tar.gz: 11bbf9de777e8474b4e68a7b76cdd32ef1fe1f8f
5
5
  SHA512:
6
- metadata.gz: 0690cbe4599e64337bbb09a07c9125b6828ee4734ec2f1d38311dbe178d519df9c8bed4fad85c2276d957d8c74d3089a46579c69e864501b41fe6066adba0fef
7
- data.tar.gz: 9a11b1e9ebe49ae02dfb2395e94cd696a38949e4632dd204d4361254bb41d6f0cd5b90117cdae41434862d174daca5ca33fcaf5bb1d60b01a54105141a31fa21
6
+ metadata.gz: 804aaba34b735e0c33aac3e5972d0ec9d2c1768ce8e830e08ecf55231955c8c45e2e8de37c12c529e8595b868fb87bd7756aabb9ffa900bc8b1d4114c24612a7
7
+ data.tar.gz: 3ce45061d77dd9daf9ca1fe673eee5da7b423aa6b79fd25987251c2ae9c6b0cb3dd857f7f3d7fae0f678fabc48e55cb296007e25d81b83a82d2f7b6b248814f0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.7.0
1
+ 6.7.1
@@ -44,7 +44,12 @@ module Blacklight::Document
44
44
  delegate :[], :key?, :keys, :to_h, to: :_source
45
45
 
46
46
  def initialize(source_doc={}, response=nil)
47
- @_source = ActiveSupport::HashWithIndifferentAccess.new(source_doc)
47
+ @_source = if source_doc.respond_to?(:to_hash)
48
+ ActiveSupport::HashWithIndifferentAccess.new(source_doc)
49
+ else
50
+ Deprecation.warn(Blacklight::Document, "Blacklight::Document#initialize expects a hash-like object, received #{source_doc.class}.")
51
+ ActiveSupport::HashWithIndifferentAccess.new(source_doc.to_h)
52
+ end
48
53
  @response = response
49
54
  apply_extensions
50
55
  end
@@ -2,10 +2,23 @@
2
2
 
3
3
  describe Blacklight::Document do
4
4
  let(:data) { {} }
5
- subject do
5
+ let(:test_class) do
6
6
  Class.new do
7
7
  include Blacklight::Document
8
- end.new(data)
8
+ end
9
+ end
10
+
11
+ subject { test_class.new(data) }
12
+
13
+ describe '.new' do
14
+ it 'accepts a hash' do
15
+ expect(test_class.new(id: 1)[:id]).to eq 1
16
+ end
17
+
18
+ it 'accepts a SolrDocument' do
19
+ expect(Deprecation).to receive(:warn)
20
+ expect(test_class.new(test_class.new(id: 1))[:id]).to eq 1
21
+ end
9
22
  end
10
23
 
11
24
  describe "#has?" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.7.0
4
+ version: 6.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2016-09-27 00:00:00.000000000 Z
20
+ date: 2016-09-28 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails