hydra-core 7.2.1 → 7.2.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: c5385ee7e7993b67f048caef766fcd449762cfdf
4
- data.tar.gz: 0b9c6cfee9dad5b5a30466b09afb5b2dd2fe83c1
3
+ metadata.gz: 7425271dd98b15843f39e0a9aa0368f38e7e2f24
4
+ data.tar.gz: e20caccecf6869f8efc0a2b73e2732bf3385bece
5
5
  SHA512:
6
- metadata.gz: f2e0cdada8d435a00f67f33d49140b2dae55a01b627cdf6b2225d5fa882a7652bbc7da6156a64c48e7b0f60a0ed797897aa060975b823abae9e090a37077e3d8
7
- data.tar.gz: 2713e19fd104d74b4871c20c1dc2efa72700339d39f2bc314b6e88aad3cf6fde26b74fdef7c230bc66a162b93ed0445da59ceee6c51610b91f97746eed983f3f
6
+ metadata.gz: ca92f74f6a0ef2e8ed0d2d74db185124b5641e9c17a79ed9c45d2a010149d77d27ec5da27dc44e9dad5019e67e0829a692f867faea5177f8e712354fa6f8fe66
7
+ data.tar.gz: 73e7990c27ae8eb7d2b00077c9ff4d6d2ccec8f99f3ecdf4621791c4a43190f2733ba1e74083091c222c07a98d0bea84f5a7314b75487a1a6a52d459f6368bd2
@@ -1,4 +1,4 @@
1
1
  module HydraHead
2
- VERSION = "7.2.1"
2
+ VERSION = "7.2.2"
3
3
  end
4
4
 
@@ -1,93 +1,66 @@
1
1
  require 'spec_helper'
2
2
 
3
- # See cucumber tests (ie. /features/edit_document.feature) for more tests, including ones that test the edit method & view
4
- # You can run the cucumber tests with
5
- #
6
- # cucumber --tags @edit
7
- # or
8
- # rake cucumber
9
-
10
3
  describe CatalogController do
11
-
4
+
12
5
  before do
13
6
  session[:user]='bob'
14
7
  end
15
-
8
+
16
9
  it "should use CatalogController" do
17
- controller.should be_an_instance_of(CatalogController)
10
+ expect(controller).to be_an_instance_of CatalogController
18
11
  end
19
-
20
-
12
+
21
13
  describe "Paths Generated by Custom Routes:" do
22
14
  # paths generated by custom routes
23
15
  it "should map {:controller=>'catalog', :action=>'index'} to GET /catalog" do
24
- { :get => "/catalog" }.should route_to(:controller => 'catalog', :action => 'index')
16
+ expect(get: "/catalog").to route_to(controller: 'catalog', action: 'index')
25
17
  end
26
18
  it "should map {:controller=>'catalog', :action=>'show', :id=>'test:3'} to GET /catalog/test:3" do
27
- { :get => "/catalog/test:3" }.should route_to(:controller => 'catalog', :action => 'show', :id=>'test:3')
19
+ expect(get: "/catalog/test:3").to route_to(controller: 'catalog', action: 'show', id: 'test:3')
28
20
  end
29
21
 
30
22
  it "should map catalog_path" do
31
- # catalog_path.should == '/catalog'
32
- catalog_path("test:3").should == '/catalog/test:3'
23
+ expect(catalog_path("test:3")).to eq '/catalog/test:3'
33
24
  end
34
25
  end
35
-
36
- it "should not choke on objects with periods in ids (ie Fedora system objects)" do
37
- skip "Need to override blacklight routes"
38
-
39
- ## We could do something like this to remove the catalog/show route and replace it with a route that allows dots (e.g. resources :catalog, :id=> /.+/)
40
- # def add_route
41
- # new_route = ActionController::Routing::Routes.builder.build(name, route_options)
42
- # ActionController::Routing::Routes.routes.insert(0, new_route)
43
- # end
44
26
 
45
- # def remove_route
46
- # ActionController::Routing::Routes.routes.reject! { |r| r.instance_variable_get(:@requirements)[:slug_id] == id }
47
- # end
48
-
49
- catalog_path("fedora-system:FedoraObject-3.0").should == '/catalog/fedora-system:FedoraObject-3.0'
50
- { :get => "/catalog/fedora-system:FedoraObject-3.0" }.should route_to(:controller => 'catalog', :action => 'show', :id=>'fedora-system:FedoraObject-3.0')
51
- end
52
-
53
27
  describe "index" do
54
-
55
28
  describe "access controls" do
56
29
  before(:all) do
57
30
  fq = "read_access_group_ssim:public OR edit_access_group_ssim:public OR discover_access_group_ssim:public"
58
- solr_opts = {:fq=>fq}
59
- response = ActiveFedora::SolrService.instance.conn.get('select', :params=> solr_opts)
31
+ solr_opts = { fq: fq }
32
+ response = ActiveFedora::SolrService.instance.conn.get('select', params: solr_opts)
60
33
  @public_only_results = Blacklight::SolrResponse.new(response, solr_opts)
61
34
  end
62
35
 
63
36
  it "should only return public documents if role does not have permissions" do
64
- controller.stub(:current_user).and_return(nil)
37
+ allow(controller).to receive(:current_user).and_return(nil)
65
38
  get :index
66
- assigns(:document_list).count.should == @public_only_results.docs.count
39
+ expect(assigns(:document_list).count).to eq @public_only_results.docs.count
67
40
  end
68
41
 
69
42
  it "should return documents if the group names need to be escaped" do
70
- RoleMapper.stub(:roles).and_return(["abc/123","cde/567"])
43
+ allow(RoleMapper).to receive(:roles).and_return(["abc/123","cde/567"])
71
44
  get :index
72
- assigns(:document_list).count.should == @public_only_results.docs.count
45
+ expect(assigns(:document_list).count).to eq @public_only_results.docs.count
73
46
  end
74
47
  end
75
48
  end
76
-
49
+
77
50
  describe "filters" do
78
51
  describe "index" do
79
52
  it "should trigger enforce_index_permissions" do
80
- controller.should_receive(:add_access_controls_to_solr_params)
53
+ expect(controller).to receive(:add_access_controls_to_solr_params)
81
54
  get :index
82
55
  end
83
56
  end
84
57
  describe "show" do
85
58
  it "should trigger enforce_show_permissions" do
86
- controller.stub(:current_user).and_return(nil)
87
- controller.should_receive(:enforce_show_permissions)
88
- get :show, :id=>'test:3'
59
+ allow(controller).to receive(:current_user).and_return(nil)
60
+ expect(controller).to receive(:enforce_show_permissions)
61
+ get :show, id: 'test:3'
89
62
  end
90
63
  end
91
64
  end
92
-
65
+
93
66
  end
@@ -60,112 +60,112 @@ describe DownloadsController do
60
60
  context "when logged in as reader" do
61
61
  before do
62
62
  sign_in @user
63
- User.any_instance.stub(:groups).and_return([])
63
+ allow_any_instance_of(User).to receive(:groups).and_return([])
64
64
  end
65
65
  describe "#show" do
66
66
  it "should default to returning default download configured by object" do
67
- ContentHolder.stub(:default_content_ds).and_return('buzz')
67
+ allow(ContentHolder).to receive(:default_content_ds).and_return('buzz')
68
68
  get "show", :id => @obj.pid
69
- response.should be_success
70
- response.headers['Content-Type'].should == "image/png"
71
- response.headers["Content-Disposition"].should == "inline; filename=\"world.png\""
72
- response.body.should == 'fizz'
69
+ expect(response).to be_success
70
+ expect(response.headers['Content-Type']).to eq "image/png"
71
+ expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"world.png\""
72
+ expect(response.body).to eq 'fizz'
73
73
  end
74
74
  it "should default to returning default download configured by controller" do
75
- DownloadsController.default_content_dsid.should == "content"
75
+ expect(DownloadsController.default_content_dsid).to eq "content"
76
76
  get "show", :id => @obj.pid
77
- response.should be_success
78
- response.headers['Content-Type'].should == "image/png"
79
- response.headers["Content-Disposition"].should == "inline; filename=\"world.png\""
80
- response.body.should == 'foobarfoobarfoobar'
77
+ expect(response).to be_success
78
+ expect(response.headers['Content-Type']).to eq "image/png"
79
+ expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"world.png\""
80
+ expect(response.body).to eq 'foobarfoobarfoobar'
81
81
  end
82
82
 
83
83
  context "when a specific datastream is requested" do
84
84
  context "and it doesn't exist" do
85
85
  it "should return :not_found when the datastream doesn't exist" do
86
86
  get "show", :id => @obj.pid, :datastream_id => "thumbnail"
87
- response.should be_not_found
87
+ expect(response).to be_not_found
88
88
  end
89
89
  end
90
90
  context "and it exists" do
91
91
  it "should return it" do
92
92
  get "show", :id => @obj.pid, :datastream_id => "descMetadata"
93
- response.should be_success
94
- response.headers['Content-Type'].should == "text/plain"
95
- response.headers["Content-Disposition"].should == "inline; filename=\"world.png\""
96
- response.body.should == "It's a stream"
93
+ expect(response).to be_success
94
+ expect(response.headers['Content-Type']).to eq "text/plain"
95
+ expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"world.png\""
96
+ expect(response.body).to eq "It's a stream"
97
97
  end
98
98
  end
99
99
  end
100
100
  it "should support setting disposition to inline" do
101
101
  get "show", :id => @obj.pid, :disposition => "inline"
102
- response.should be_success
103
- response.headers['Content-Type'].should == "image/png"
104
- response.headers["Content-Disposition"].should == "inline; filename=\"world.png\""
105
- response.body.should == 'foobarfoobarfoobar'
102
+ expect(response).to be_success
103
+ expect(response.headers['Content-Type']).to eq "image/png"
104
+ expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"world.png\""
105
+ expect(response.body).to eq 'foobarfoobarfoobar'
106
106
  end
107
107
  it "should allow you to specify filename for download" do
108
108
  get "show", :id => @obj.pid, "filename" => "my%20dog.png"
109
- response.should be_success
110
- response.headers['Content-Type'].should == "image/png"
111
- response.headers["Content-Disposition"].should == "inline; filename=\"my%20dog.png\""
112
- response.body.should == 'foobarfoobarfoobar'
109
+ expect(response).to be_success
110
+ expect(response.headers['Content-Type']).to eq "image/png"
111
+ expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"my%20dog.png\""
112
+ expect(response.body).to eq 'foobarfoobarfoobar'
113
113
  end
114
114
  end
115
115
  describe "stream" do
116
116
  before do
117
- stub_response = double()
118
- stub_response.stub(:read_body).and_yield("one1").and_yield('two2').and_yield('thre').and_yield('four')
119
- stub_repo = double()
120
- stub_repo.stub(:datastream_dissemination).and_yield(stub_response)
117
+ stub_response = double
118
+ allow(stub_response).to receive(:read_body).and_yield("one1").and_yield('two2').and_yield('thre').and_yield('four')
119
+ stub_repo = double
120
+ allow(stub_repo).to receive(:datastream_dissemination).and_yield(stub_response)
121
121
  stub_ds = ActiveFedora::Datastream.new
122
- stub_ds.stub(:repository).and_return(stub_repo)
123
- stub_ds.stub(:mimeType).and_return('video/webm')
124
- stub_ds.stub(:dsSize).and_return(16)
125
- stub_ds.stub(:dsid).and_return('webm')
126
- stub_ds.stub(:new?).and_return(false)
127
- stub_ds.stub(:pid).and_return('changeme:test')
122
+ allow(stub_ds).to receive(:repository).and_return(stub_repo)
123
+ allow(stub_ds).to receive(:mimeType).and_return('video/webm')
124
+ allow(stub_ds).to receive(:dsSize).and_return(16)
125
+ allow(stub_ds).to receive(:dsid).and_return('webm')
126
+ allow(stub_ds).to receive(:new?).and_return(false)
127
+ allow(stub_ds).to receive(:pid).and_return('changeme:test')
128
128
  stub_file = double('stub object', datastreams: {'webm' => stub_ds}, pid:'changeme:test', label: "MyVideo.webm")
129
- ActiveFedora::Base.should_receive(:load_instance_from_solr).with('changeme:test').and_return(stub_file)
130
- controller.stub(:authorize!).with(:download, stub_ds).and_return(true)
131
- controller.stub(:log_download)
129
+ expect(ActiveFedora::Base).to receive(:load_instance_from_solr).with('changeme:test').and_return(stub_file)
130
+ allow(controller).to receive(:authorize!).with(:download, stub_ds).and_return(true)
131
+ allow(controller).to receive(:log_download)
132
132
  end
133
133
  it "head request" do
134
134
  request.env["HTTP_RANGE"] = 'bytes=0-15'
135
135
  head :show, id: 'changeme:test', datastream_id: 'webm'
136
- response.headers['Content-Length'].should == 16
137
- response.headers['Accept-Ranges'].should == 'bytes'
138
- response.headers['Content-Type'].should == 'video/webm'
136
+ expect(response.headers['Content-Length']).to eq 16
137
+ expect(response.headers['Accept-Ranges']).to eq 'bytes'
138
+ expect(response.headers['Content-Type']).to eq 'video/webm'
139
139
  end
140
140
  it "should send the whole thing" do
141
141
  request.env["HTTP_RANGE"] = 'bytes=0-15'
142
142
  get :show, id: 'changeme:test', datastream_id: 'webm'
143
- response.body.should == 'one1two2threfour'
144
- response.headers["Content-Range"].should == 'bytes 0-15/16'
145
- response.headers["Content-Length"].should == '16'
146
- response.headers['Accept-Ranges'].should == 'bytes'
147
- response.headers['Content-Type'].should == "video/webm"
148
- response.headers["Content-Disposition"].should == "inline; filename=\"MyVideo.webm\""
149
- response.status.should == 206
143
+ expect(response.body).to eq 'one1two2threfour'
144
+ expect(response.headers["Content-Range"]).to eq 'bytes 0-15/16'
145
+ expect(response.headers["Content-Length"]).to eq '16'
146
+ expect(response.headers['Accept-Ranges']).to eq 'bytes'
147
+ expect(response.headers['Content-Type']).to eq "video/webm"
148
+ expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"MyVideo.webm\""
149
+ expect(response.status).to eq 206
150
150
  end
151
151
  it "should send the whole thing when the range is open ended" do
152
152
  request.env["Range"] = 'bytes=0-'
153
153
  get :show, id: 'changeme:test', datastream_id: 'webm'
154
- response.body.should == 'one1two2threfour'
154
+ expect(response.body).to eq 'one1two2threfour'
155
155
  end
156
156
  it "should get a range not starting at the beginning" do
157
157
  request.env["HTTP_RANGE"] = 'bytes=3-15'
158
158
  get :show, id: 'changeme:test', datastream_id: 'webm'
159
- response.body.should == '1two2threfour'
160
- response.headers["Content-Range"].should == 'bytes 3-15/16'
161
- response.headers["Content-Length"].should == '13'
159
+ expect(response.body).to eq '1two2threfour'
160
+ expect(response.headers["Content-Range"]).to eq 'bytes 3-15/16'
161
+ expect(response.headers["Content-Length"]).to eq '13'
162
162
  end
163
163
  it "should get a range not ending at the end" do
164
164
  request.env["HTTP_RANGE"] = 'bytes=4-11'
165
165
  get :show, id: 'changeme:test', datastream_id: 'webm'
166
- response.body.should == 'two2thre'
167
- response.headers["Content-Range"].should == 'bytes 4-11/16'
168
- response.headers["Content-Length"].should == '8'
166
+ expect(response.body).to eq 'two2thre'
167
+ expect(response.headers["Content-Range"]).to eq 'bytes 4-11/16'
168
+ expect(response.headers["Content-Length"]).to eq '8'
169
169
  end
170
170
  end
171
171
  end
@@ -180,9 +180,9 @@ describe DownloadsController do
180
180
  sign_in @user
181
181
  end
182
182
  it "should use the custom param value to retrieve the asset" do
183
- controller.stub(:asset_param_key).and_return(:object_id)
183
+ allow(controller).to receive(:asset_param_key).and_return(:object_id)
184
184
  get "show", :object_id => @obj.pid
185
- response.should be_successful
185
+ expect(response).to be_successful
186
186
  end
187
187
  end
188
188
 
@@ -190,8 +190,8 @@ describe DownloadsController do
190
190
  before { sign_in @user }
191
191
  context "current_ability.can? returns true / can_download? returns false" do
192
192
  it "should authorize according to can_download?" do
193
- controller.current_ability.can?(:download, @obj.datastreams['buzz']).should be true
194
- controller.stub(:can_download?).and_return(false)
193
+ expect(controller.current_ability.can?(:download, @obj.datastreams['buzz'])).to be true
194
+ allow(controller).to receive(:can_download?).and_return(false)
195
195
  Deprecation.silence(Hydra::Controller::DownloadBehavior) do
196
196
  get :show, id: @obj, datastream_id: 'buzz'
197
197
  end
@@ -204,12 +204,12 @@ describe DownloadsController do
204
204
  @obj.save
205
205
  end
206
206
  it "should authorize according to can_download?" do
207
- controller.current_ability.can?(:download, @obj.datastreams['buzz']).should be false
208
- controller.stub(:can_download?).and_return(true)
207
+ expect(controller.current_ability.can?(:download, @obj.datastreams['buzz'])).to be false
208
+ allow(controller).to receive(:can_download?).and_return(true)
209
209
  Deprecation.silence(Hydra::Controller::DownloadBehavior) do
210
210
  get :show, id: @obj, datastream_id: 'buzz'
211
211
  end
212
- response.should be_successful
212
+ expect(response).to be_successful
213
213
  end
214
214
  end
215
215
  end
@@ -2,29 +2,32 @@ require 'spec_helper'
2
2
 
3
3
  describe BlacklightHelper do
4
4
  describe "document_partial_name" do
5
- it "should lop off everything before the first colin after the slash" do
6
- @config = Blacklight::Configuration.new.configure do |config|
7
- config.show.display_type_field = 'has_model_s'
5
+ let(:field_name) { 'has_model_s' }
6
+
7
+ let(:config) do
8
+ Blacklight::Configuration.new.configure do |config|
9
+ config.show.display_type_field = field_name
8
10
  end
9
- helper.stub(:blacklight_config).and_return(@config)
10
- helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:Presentation"]).should == "presentation"
11
- helper.document_partial_name('has_model_s' => ["info:fedora/hull-cModel:genericContent"]).should == "generic_content"
12
11
  end
13
- it "should support single valued fields" do
14
- @config = Blacklight::Configuration.new.configure do |config|
15
- config.show.display_type_field = 'active_fedora_model_ssi'
12
+
13
+ before do
14
+ allow(helper).to receive(:blacklight_config).and_return(config)
15
+ end
16
+
17
+ it "should lop off everything before the first colin after the slash" do
18
+ expect(helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:Presentation"])).to eq "presentation"
19
+ expect(helper.document_partial_name('has_model_s' => ["info:fedora/hull-cModel:genericContent"])).to eq "generic_content"
20
+ end
21
+
22
+ context "with a single valued field" do
23
+ let(:field_name) { 'active_fedora_model_ssi' }
24
+ it "should support single valued fields" do
25
+ expect(helper.document_partial_name('active_fedora_model_ssi' => "Chicken")).to eq "chicken"
16
26
  end
17
- helper.stub(:blacklight_config).and_return(@config)
18
- helper.document_partial_name('active_fedora_model_ssi' => "Chicken").should == "chicken"
19
27
  end
20
28
 
21
29
  it "should handle periods" do
22
- @config = Blacklight::Configuration.new.configure do |config|
23
- config.show.display_type_field = 'has_model_s'
24
- end
25
- helper.stub(:blacklight_config).and_return(@config)
26
- helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:text.PDF"]).should == "text_pdf"
30
+ expect(helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:text.PDF"])).to eq "text_pdf"
27
31
  end
28
32
  end
29
-
30
33
  end
@@ -1,16 +1,15 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Hydra::Controller::ControllerBehavior do
4
-
5
- before(:all) do
4
+
5
+ before do
6
6
  class CatalogTest < ApplicationController
7
7
  include Hydra::Controller::ControllerBehavior
8
8
  end
9
- @catalog = CatalogTest.new
10
9
  end
11
10
 
12
11
  it "should extend classes with the necessary Hydra modules" do
13
- CatalogTest.included_modules.should include(Hydra::AccessControlsEnforcement)
12
+ expect(CatalogTest.included_modules).to include(Hydra::AccessControlsEnforcement)
14
13
  end
15
-
14
+
16
15
  end
@@ -1,7 +1,7 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Hydra::ModelMethods do
4
-
4
+
5
5
  before :all do
6
6
  class TestModel < ActiveFedora::Base
7
7
  include Hydra::AccessControls::Permissions
@@ -10,26 +10,26 @@ describe Hydra::ModelMethods do
10
10
  end
11
11
  end
12
12
 
13
- subject {TestModel.new }
13
+ subject { TestModel.new }
14
14
 
15
15
  describe "apply_depositor_metadata" do
16
16
  it "should add edit access" do
17
17
  subject.apply_depositor_metadata('naomi')
18
- subject.rightsMetadata.users.should == {'naomi' => 'edit'}
18
+ expect(subject.rightsMetadata.users).to eq('naomi' => 'edit')
19
19
  end
20
20
  it "should not overwrite people with edit access" do
21
21
  subject.rightsMetadata.permissions({:person=>"jessie"}, 'edit')
22
22
  subject.apply_depositor_metadata('naomi')
23
- subject.rightsMetadata.users.should == {'naomi' => 'edit', 'jessie' =>'edit'}
23
+ expect(subject.rightsMetadata.users).to eq('naomi' => 'edit', 'jessie' =>'edit')
24
24
  end
25
25
  it "should set depositor" do
26
26
  subject.apply_depositor_metadata('chris')
27
- subject.properties.depositor.should == ['chris']
27
+ expect(subject.properties.depositor).to eq ['chris']
28
28
  end
29
29
  it "should accept objects that respond_to? :user_key" do
30
30
  stub_user = double(:user, :user_key=>'monty')
31
31
  subject.apply_depositor_metadata(stub_user)
32
- subject.properties.depositor.should == ['monty']
32
+ expect(subject.properties.depositor).to eq ['monty']
33
33
  end
34
34
  end
35
35
 
@@ -37,9 +37,9 @@ describe Hydra::ModelMethods do
37
37
  it "should set the dsid, mimetype and content" do
38
38
  file_name = "my_file.foo"
39
39
  mock_file = "File contents"
40
- subject.should_receive(:add_file_datastream).with(mock_file, :label=>file_name, :mimeType=>"mymimetype", :dsid=>'bar')
41
- subject.should_receive(:set_title_and_label).with( file_name, :only_if_blank=>true )
42
- MIME::Types.should_receive(:of).with(file_name).and_return([double(:content_type=>"mymimetype")])
40
+ expect(subject).to receive(:add_file_datastream).with(mock_file, :label=>file_name, :mimeType=>"mymimetype", :dsid=>'bar')
41
+ expect(subject).to receive(:set_title_and_label).with( file_name, :only_if_blank=>true )
42
+ expect(MIME::Types).to receive(:of).with(file_name).and_return([double(:content_type=>"mymimetype")])
43
43
  subject.add_file(mock_file, 'bar', file_name)
44
44
  end
45
45
  end
@@ -1,21 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ModsAsset do
4
-
5
- before(:each) do
6
- @asset = ModsAsset.new nil
7
- end
8
-
4
+
5
+ let(:asset) { ModsAsset.new nil }
6
+
9
7
  it "Should be a kind of ActiveFedora::Base" do
10
- @asset.should be_kind_of(ActiveFedora::Base)
8
+ expect(asset).to be_kind_of(ActiveFedora::Base)
11
9
  end
12
-
10
+
13
11
  it "should set up descMetadata and rightsMetadata datastreams" do
14
- # Mods article was moved to the mods gem. Ask cbeer about this. Jcoyne 2012-07-10
15
- #@asset.datastreams.should have_key("descMetadata")
16
- #@asset.datastreams["descMetadata"].should be_instance_of(Hydra::Datastream::ModsArticle)
17
- @asset.datastreams.should have_key("rightsMetadata")
18
- @asset.datastreams["rightsMetadata"].should be_instance_of(Hydra::Datastream::RightsMetadata)
12
+ expect(asset.datastreams).to have_key("rightsMetadata")
13
+ expect(asset.datastreams["rightsMetadata"]).to be_instance_of(Hydra::Datastream::RightsMetadata)
19
14
  end
20
-
15
+
21
16
  end
@@ -5,12 +5,13 @@ describe SolrDocument do
5
5
 
6
6
  before do
7
7
  class SolrDocumentWithHydraOverride < SolrDocument
8
- include Hydra::Solr::Document
8
+ include Hydra::Solr::Document
9
9
  end
10
10
  end
11
+
11
12
  # this isn't a great test, but...
12
13
  it "should try to cast the SolrDocument to the Fedora object" do
13
- ActiveFedora::Base.should_receive(:load_instance_from_solr).with('asdfg', kind_of(SolrDocument))
14
+ expect(ActiveFedora::Base).to receive(:load_instance_from_solr).with('asdfg', kind_of(SolrDocument))
14
15
  SolrDocumentWithHydraOverride.new(:id => 'asdfg').to_model
15
16
  end
16
17
  end
@@ -3,18 +3,18 @@ require 'spec_helper'
3
3
  describe User do
4
4
 
5
5
  describe "user_key" do
6
+ let(:user) { User.new.tap {|u| u.email = "foo@example.com"} }
6
7
  before do
7
- @user = User.new.tap {|u| u.email = "foo@example.com"}
8
- @user.stub(:username =>'foo')
8
+ allow(user).to receive(:username).and_return('foo')
9
9
  end
10
10
 
11
11
  it "should return email" do
12
- @user.user_key.should == 'foo@example.com'
12
+ expect(user.user_key).to eq 'foo@example.com'
13
13
  end
14
14
 
15
15
  it "should return username" do
16
- Devise.stub(:authentication_keys =>[:username])
17
- @user.user_key.should == 'foo'
16
+ allow(Devise).to receive(:authentication_keys).and_return([:username])
17
+ expect(user.user_key).to eq 'foo'
18
18
  end
19
19
 
20
20
  end
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,6 @@ ENV["RAILS_ENV"] ||= "test"
6
6
  require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
7
7
  require 'bundler/setup'
8
8
  require 'rspec/rails'
9
- require 'rspec/autorun'
10
9
  require 'hydra-core'
11
10
 
12
11
  if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/
@@ -2,7 +2,6 @@ require 'rspec/core/rake_task'
2
2
  desc "run the hydra-core gem spec"
3
3
  gem_home = File.expand_path('../../../../..', __FILE__)
4
4
  RSpec::Core::RakeTask.new(:myspec) do |t|
5
- t.pattern = gem_home + '/spec/**/*_spec.rb'
6
- t.rspec_opts = "--colour"
5
+ t.rspec_opts = ["--colour", '--backtrace', "--default-path #{gem_home}"]
7
6
  t.ruby_opts = "-I#{gem_home}/spec"
8
7
  end
@@ -1,8 +1,6 @@
1
1
  group :develop do
2
2
  gem 'active-fedora', github: "projecthydra/active_fedora"
3
3
  end
4
- # Temporary fix for https://github.com/twbs/bootstrap-sass/issues/647 on Rails 3
5
- gem 'bootstrap-sass', github: 'twbs/bootstrap-sass', ref: '540ad23'
6
- gem 'rspec-rails', '~> 3.0', group: :test
4
+ gem 'rspec-rails', '~> 3.1', group: :test
7
5
  gem 'rspec-its'
8
6
 
@@ -1,7 +1,7 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe HydraHead::Engine do
4
4
  it "should be a subclass of Rails::Engine" do
5
- HydraHead::Engine.superclass.should == Rails::Engine
5
+ expect(HydraHead::Engine.superclass).to eq Rails::Engine
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe HydraHead do
4
4
  it "should be valid" do
5
- HydraHead.should be_a(Module)
5
+ expect(HydraHead).to be_a(Module)
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.1
4
+ version: 7.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-02 00:00:00.000000000 Z
12
+ date: 2014-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 7.2.1
54
+ version: 7.2.2
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 7.2.1
61
+ version: 7.2.2
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: jettywrapper
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  version: '0'
218
218
  requirements: []
219
219
  rubyforge_project:
220
- rubygems_version: 2.4.1
220
+ rubygems_version: 2.2.2
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: Hydra-Head Rails Engine (requires Rails3)