hydra-batch-edit 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +5 -0
- data/.travis.yml +6 -0
- data/app/controllers/concerns/hydra/batch_edit_behavior.rb +2 -2
- data/lib/hydra/batch_edit/version.rb +1 -1
- data/spec/controllers/batch_edits_controller_spec.rb +29 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49eb4f38e25d7b886f7069572baa623ea0602172
|
4
|
+
data.tar.gz: ed6a555e20a829174d1fd90ef11080601afe9a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba85956838b2f175908c1e8c80b84906d010bf8cccb2fb7861b601c8653098987b7d100880561193a38fdc05fa5f1fdf513422979423672219690b9f008be94
|
7
|
+
data.tar.gz: 28ae45abf6af7337460cdc7e9a4525ef2a6d0068de06ade7335d0aaca3a397fb28aea80156489a5abbc1336e01c1615c0ba2a2996f703ee346c4b04619a467d9
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require: rubocop-rspec
|
1
2
|
# This configuration was generated by
|
2
3
|
# `rubocop --auto-gen-config`
|
3
4
|
# on 2016-04-20 07:34:46 -0700 using RuboCop version 0.39.0.
|
@@ -53,6 +54,10 @@ Lint/Void:
|
|
53
54
|
Metrics/MethodLength:
|
54
55
|
Max: 17
|
55
56
|
|
57
|
+
RSpec/VerifiedDoubles:
|
58
|
+
Exclude:
|
59
|
+
- 'spec/controllers/batch_edits_controller_spec.rb'
|
60
|
+
|
56
61
|
# Offense count: 1
|
57
62
|
RSpec/AnyInstance:
|
58
63
|
Exclude:
|
data/.travis.yml
CHANGED
@@ -5,8 +5,8 @@ module Hydra
|
|
5
5
|
included do
|
6
6
|
include CurationConcerns::Collections::AcceptsBatches
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
before_action :filter_docs_with_access!, :only=>[:edit, :update, :destroy_collection]
|
9
|
+
before_action :check_for_empty!, :only=>[:edit, :update, :destroy_collection]
|
10
10
|
end
|
11
11
|
|
12
12
|
# fetch the documents that match the ids in the folder
|
@@ -43,18 +43,25 @@ describe BatchEditsController do
|
|
43
43
|
|
44
44
|
end
|
45
45
|
it "should complain when none are in the batch " do
|
46
|
-
put :update, :multiresimage=>{:titleSet_display=>'My title' }
|
46
|
+
put :update, :multiresimage=>{:titleSet_display=>'My title' }
|
47
47
|
expect(response).to redirect_to 'where_i_came_from'
|
48
48
|
expect(flash[:notice]).to eq("Select something first")
|
49
49
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
|
51
|
+
context "when the user doesn't have permissions" do
|
52
|
+
before do
|
53
|
+
controller.batch = [@one.pid, @two.pid]
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should not update when the user doesn't have permissions" do
|
57
|
+
expect(controller).to receive(:can?).with(:edit, @one.pid).and_return(false)
|
58
|
+
expect(controller).to receive(:can?).with(:edit, @two.pid).and_return(false)
|
59
|
+
put :update, :multiresimage=>{:titleSet_display=>'My title' }
|
60
|
+
expect(response).to redirect_to 'where_i_came_from'
|
61
|
+
expect(flash[:notice]).to eq("You do not have permission to edit the documents: #{@one.pid}, #{@two.pid}")
|
62
|
+
end
|
57
63
|
end
|
64
|
+
|
58
65
|
describe "when current user has access to the documents" do
|
59
66
|
before do
|
60
67
|
@one.save
|
@@ -95,14 +102,21 @@ describe BatchEditsController do
|
|
95
102
|
expect(response).to redirect_to 'where_i_came_from'
|
96
103
|
expect(flash[:notice]).to eq("Select something first")
|
97
104
|
end
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
+
|
106
|
+
context "when the user doesn't have permissions" do
|
107
|
+
before do
|
108
|
+
controller.batch = [@one.pid, @two.pid]
|
109
|
+
end
|
110
|
+
|
111
|
+
it "does not update" do
|
112
|
+
expect(controller).to receive(:can?).with(:edit, @one.pid).and_return(false)
|
113
|
+
expect(controller).to receive(:can?).with(:edit, @two.pid).and_return(false)
|
114
|
+
delete :destroy_collection
|
115
|
+
expect(response).to redirect_to 'where_i_came_from'
|
116
|
+
expect(flash[:notice]).to eq("You do not have permission to edit the documents: #{@one.pid}, #{@two.pid}")
|
117
|
+
end
|
105
118
|
end
|
119
|
+
|
106
120
|
describe "when current user has access to the documents" do
|
107
121
|
before do
|
108
122
|
@one.save
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-batch-edit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.5.1
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Rails engine to do batch editing with curation_concerns
|