blacklight-spotlight 0.26.0 → 0.26.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb87cc0336538721053f1ae27eb72f144a749e34
|
4
|
+
data.tar.gz: 7f6f669a329a037b4837b425e0f794d3e00ed237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d79777da225046b586c153aa3f0401b25c50ce3c9e3189ad22eea395c28615a03a30e7aa4625303e2bb69416c374ffefee60f78d053ec0c5ebbe685e8e737d7a
|
7
|
+
data.tar.gz: fb37ce544eeb851a99b06327a54493b6b929f5cdddff430c32a35345fb25a8ee7ff26a3ce7da73367060a1dd851ac8397ec4aa74fe6e63c7c7390dbbc22032b4
|
@@ -9,6 +9,8 @@ module Spotlight
|
|
9
9
|
# explicit options support better subclassing
|
10
10
|
load_and_authorize_resource through: :exhibit, instance_name: :resource, through_association: :resources
|
11
11
|
|
12
|
+
helper_method :resource_class
|
13
|
+
|
12
14
|
def new
|
13
15
|
add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), exhibit_root_path(@exhibit)
|
14
16
|
add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
@@ -22,6 +24,7 @@ module Spotlight
|
|
22
24
|
if @resource.save_and_index
|
23
25
|
redirect_to spotlight.admin_exhibit_catalog_path(@resource.exhibit, sort: :timestamp)
|
24
26
|
else
|
27
|
+
flash[:error] = @resource.errors.full_messages.to_sentence if @resource.errors.present?
|
25
28
|
render action: 'new'
|
26
29
|
end
|
27
30
|
end
|
data/lib/spotlight/version.rb
CHANGED
@@ -52,12 +52,21 @@ describe Spotlight::ResourcesController, type: :controller do
|
|
52
52
|
|
53
53
|
describe 'POST create' do
|
54
54
|
let(:blacklight_solr) { double }
|
55
|
+
let(:invalid_resource) { Spotlight::Resource.new.tap { |x| x.errors.add(:url, 'is invalid') } }
|
55
56
|
it 'create a resource' do
|
56
|
-
expect_any_instance_of(Spotlight::Resource).to receive(:reindex_later)
|
57
|
+
expect_any_instance_of(Spotlight::Resource).to receive(:reindex_later).and_return(true)
|
57
58
|
allow_any_instance_of(Spotlight::Resource).to receive(:blacklight_solr).and_return blacklight_solr
|
58
59
|
post :create, params: { exhibit_id: exhibit, resource: { url: 'info:uri' } }
|
59
60
|
expect(assigns[:resource]).to be_persisted
|
60
61
|
end
|
62
|
+
|
63
|
+
it 'adds errors to the flash message' do
|
64
|
+
allow_any_instance_of(Spotlight::Resource).to receive_messages(save: false)
|
65
|
+
allow_any_instance_of(Spotlight::Resource).to receive(:errors).and_return invalid_resource.errors
|
66
|
+
post :create, params: { exhibit_id: exhibit, resource: { url: 'info:uri' } }
|
67
|
+
expect(assigns[:resource]).not_to be_persisted
|
68
|
+
expect(flash[:error]).to include 'Url is invalid'
|
69
|
+
end
|
61
70
|
end
|
62
71
|
|
63
72
|
describe 'POST reindex_all' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-spotlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-08-
|
14
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|