hydra-head 3.1.0.pre2 → 3.1.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/Gemfile.lock +12 -14
  2. data/app/helpers/application_helper.rb +1 -0
  3. data/app/helpers/hydra_helper.rb +6 -1
  4. data/app/views/_user_util_links.html.erb +1 -1
  5. data/app/views/permissions/_edit_person_permissions.html.erb +1 -1
  6. data/hydra-head.gemspec +4 -4
  7. data/lib/hydra-head/version.rb +1 -1
  8. data/lib/hydra/access_controls_enforcement.rb +11 -9
  9. data/lib/hydra/access_controls_evaluation.rb +1 -1
  10. data/lib/hydra/assets_controller_helper.rb +5 -5
  11. data/lib/hydra/controller.rb +6 -1
  12. data/lib/railties/hydra_jetty.rake +3 -40
  13. data/spec/controllers/catalog_valid_html_spec.rb +3 -3
  14. data/tasks/hydra-head.rake +53 -53
  15. data/tasks/hydra_jetty.rake +5 -39
  16. data/test_support/etc/Gemfile +1 -0
  17. data/test_support/features/html_validity.feature +1 -0
  18. data/test_support/spec/controllers/catalog_controller_spec.rb +1 -1
  19. data/test_support/spec/controllers/catalog_controller_viewing_context_spec.rb +1 -1
  20. data/test_support/spec/controllers/file_assets_controller_spec.rb +2 -5
  21. data/test_support/spec/helpers/access_controls_enforcement_spec.rb +11 -14
  22. data/test_support/spec/helpers/access_controls_evaluation_spec.rb +3 -3
  23. data/vendor/cache/jettywrapper-1.0.4.gem +0 -0
  24. data/vendor/cache/rspec-2.7.0.gem +0 -0
  25. data/vendor/cache/rspec-core-2.7.1.gem +0 -0
  26. data/vendor/cache/rspec-expectations-2.7.0.gem +0 -0
  27. data/vendor/cache/rspec-mocks-2.7.0.gem +0 -0
  28. data/vendor/cache/rspec-rails-2.7.0.gem +0 -0
  29. metadata +29 -59
  30. data/vendor/cache/jettywrapper-1.0.2.gem +0 -0
  31. data/vendor/cache/rspec-2.6.0.gem +0 -0
  32. data/vendor/cache/rspec-core-2.6.4.gem +0 -0
  33. data/vendor/cache/rspec-expectations-2.6.0.gem +0 -0
  34. data/vendor/cache/rspec-mocks-2.6.0.gem +0 -0
  35. data/vendor/cache/rspec-rails-2.6.1.gem +0 -0
data/Gemfile.lock CHANGED
@@ -144,7 +144,7 @@ GEM
144
144
  httpi (0.9.5)
145
145
  rack
146
146
  i18n (0.5.0)
147
- jettywrapper (1.0.2)
147
+ jettywrapper (1.0.4)
148
148
  activesupport (>= 3.0.0)
149
149
  childprocess
150
150
  i18n
@@ -213,19 +213,19 @@ GEM
213
213
  builder (>= 2.1.2)
214
214
  rsolr-ext (1.0.3)
215
215
  rsolr (>= 1.0.2)
216
- rspec (2.6.0)
217
- rspec-core (~> 2.6.0)
218
- rspec-expectations (~> 2.6.0)
219
- rspec-mocks (~> 2.6.0)
220
- rspec-core (2.6.4)
221
- rspec-expectations (2.6.0)
216
+ rspec (2.7.0)
217
+ rspec-core (~> 2.7.0)
218
+ rspec-expectations (~> 2.7.0)
219
+ rspec-mocks (~> 2.7.0)
220
+ rspec-core (2.7.1)
221
+ rspec-expectations (2.7.0)
222
222
  diff-lcs (~> 1.1.2)
223
- rspec-mocks (2.6.0)
224
- rspec-rails (2.6.1)
223
+ rspec-mocks (2.7.0)
224
+ rspec-rails (2.7.0)
225
225
  actionpack (~> 3.0)
226
226
  activesupport (~> 3.0)
227
227
  railties (~> 3.0)
228
- rspec (~> 2.6.0)
228
+ rspec (~> 2.7.0)
229
229
  ruby-debug (0.10.4)
230
230
  columnize (>= 0.1)
231
231
  ruby-debug-base (~> 0.10.4.0)
@@ -295,12 +295,10 @@ DEPENDENCIES
295
295
  factory_girl
296
296
  gherkin
297
297
  hydra-head!
298
- jettywrapper (>= 1.0.0)
298
+ jettywrapper (>= 1.0.4)
299
299
  mocha
300
300
  rake
301
- rest-client
302
- rspec (>= 2.0.0)
303
- rspec-rails (>= 2.0.0)
301
+ rspec-rails (>= 2.7.0)
304
302
  ruby-debug
305
303
  ruby-debug-base
306
304
  yard
@@ -164,4 +164,5 @@ module ApplicationHelper
164
164
  new_params
165
165
  end
166
166
 
167
+
167
168
  end
@@ -175,5 +175,10 @@ module HydraHelper
175
175
  return "Save and Continue"
176
176
  end
177
177
  end
178
-
178
+
179
+ ### TODO this method is also in Hydra::Controller -- DRY it out
180
+ def user_key
181
+ current_user.send(Devise.authentication_keys.first)
182
+ end
183
+
179
184
  end
@@ -11,7 +11,7 @@
11
11
  <% end %>
12
12
  <%= link_to "Log Out", destroy_user_session_path %>
13
13
  [
14
- <%= link_to current_user.login, edit_user_registration_path %>
14
+ <%= link_to current_user.to_s, edit_user_registration_path %>
15
15
  ]
16
16
  |
17
17
  <%= link_to 'Your Bookmarks', bookmarks_path %>
@@ -9,7 +9,7 @@
9
9
  -# In the future, we should show current_user's permissions and just disable the ability to modify
10
10
  %>
11
11
 
12
- <% if person_id != current_user.login %>
12
+ <% if person_id != user_key %>
13
13
  <% field_name = "#{person_id}_access" %>
14
14
  <% choices = [{"No Access" => "none"},{"Discover" => "discover"}, {"Read & Download" => "read"}, {"Edit & Upload" => "edit"}] %>
15
15
  <% current_permissions = @document_fedora.datastreams["rightsMetadata"].permissions({"person"=>person_id}) %>
data/hydra-head.gemspec CHANGED
@@ -48,12 +48,12 @@ Gem::Specification.new do |s|
48
48
  s.add_dependency 'sanitize'
49
49
 
50
50
  s.add_development_dependency 'yard'
51
- s.add_development_dependency 'jettywrapper', ">=1.0.0"
51
+ s.add_development_dependency 'jettywrapper', ">=1.0.4"
52
52
  s.add_development_dependency 'ruby-debug'
53
53
  s.add_development_dependency 'ruby-debug-base'
54
- s.add_development_dependency 'rspec', '>= 2.0.0'
55
- s.add_development_dependency 'rspec-rails', '>= 2.0.0' # rspec-rails 2.0.0 requires Rails 3.
56
- s.add_development_dependency 'rest-client'
54
+ # s.add_development_dependency 'rspec', '>= 2.0.0'
55
+ s.add_development_dependency 'rspec-rails', '>= 2.7.0'
56
+ # s.add_development_dependency 'rest-client'
57
57
  s.add_development_dependency 'mocha'
58
58
  s.add_development_dependency 'cucumber', '>=0.8.5'
59
59
  s.add_development_dependency 'cucumber-rails', '>=1.0.0'
@@ -1,4 +1,4 @@
1
1
  module HydraHead
2
- VERSION = "3.1.0.pre2"
2
+ VERSION = "3.1.0.pre3"
3
3
  end
4
4
 
@@ -96,8 +96,9 @@ module Hydra::AccessControlsEnforcement
96
96
  if @permissions_solr_document["embargo_release_date_dt"]
97
97
  embargo_date = Date.parse(@permissions_solr_document["embargo_release_date_dt"].split(/T/)[0])
98
98
  if embargo_date > Date.parse(Time.now.to_s)
99
- # check for depositor raise "#{@document["depositor_t"].first} --- #{current_user.login}"
100
- unless current_user && current_user.login == @permissions_solr_document["depositor_t"].first
99
+ # check for depositor raise "#{@document["depositor_t"].first} --- #{user_key}"
100
+ ### Assuming we're using devise and have only one authentication key
101
+ unless current_user && user_key == @permissions_solr_document["depositor_t"].first
101
102
  flash[:notice] = "This item is under embargo. You do not have sufficient access privileges to read this document."
102
103
  redirect_to(:action=>'index', :q=>nil, :f=>nil) and return false
103
104
  end
@@ -184,14 +185,14 @@ module Hydra::AccessControlsEnforcement
184
185
  # Grant access based on user id & role
185
186
  unless current_user.nil?
186
187
  # for roles
187
- RoleMapper.roles(current_user.login).each_with_index do |role, i|
188
+ RoleMapper.roles(user_key).each_with_index do |role, i|
188
189
  permission_types.each do |type|
189
190
  user_access_filters << "#{type}_access_group_t:#{role}"
190
191
  end
191
192
  end
192
193
  # for individual person access
193
194
  permission_types.each do |type|
194
- user_access_filters << "#{type}_access_person_t:#{current_user.login}"
195
+ user_access_filters << "#{type}_access_person_t:#{user_key}"
195
196
  end
196
197
  if current_user.is_being_superuser?(session)
197
198
  permission_types.each do |type|
@@ -203,8 +204,8 @@ module Hydra::AccessControlsEnforcement
203
204
  # If you want to do this, set up your own solr_search_params before_filter that injects the appropriate :fq constraints for a field that expresses your objects' embargo status.
204
205
  #
205
206
  # include docs in results if the embargo date is NOT in the future OR if the current user is depositor
206
- # embargo_query = "(NOT embargo_release_date_dt:[NOW TO *]) OR depositor_t:#{current_user.login}"
207
- # embargo_query = "(NOT embargo_release_date_dt:[NOW TO *]) OR (embargo_release_date_dt:[NOW TO *] AND depositor_t:#{current_user.login}) AND NOT (NOT depositor_t:#{current_user.login} AND embargo_release_date_dt:[NOW TO *])"
207
+ # embargo_query = "(NOT embargo_release_date_dt:[NOW TO *]) OR depositor_t:#{user_key}"
208
+ # embargo_query = "(NOT embargo_release_date_dt:[NOW TO *]) OR (embargo_release_date_dt:[NOW TO *] AND depositor_t:#{user_key}) AND NOT (NOT depositor_t:#{user_key} AND embargo_release_date_dt:[NOW TO *])"
208
209
  # solr_parameters[:fq] << embargo_query
209
210
  end
210
211
  solr_parameters[:fq] << user_access_filters.join(" OR ")
@@ -252,14 +253,14 @@ module Hydra::AccessControlsEnforcement
252
253
 
253
254
  unless current_user.nil?
254
255
  # for roles
255
- RoleMapper.roles(current_user.login).each do |role|
256
+ RoleMapper.roles(user_key).each do |role|
256
257
  permission_types.each do |type|
257
258
  field_queries << "_query_:\"#{type}_access_group_t:#{role}\""
258
259
  end
259
260
  end
260
261
  # for individual person access
261
262
  permission_types.each do |type|
262
- field_queries << "_query_:\"#{type}_access_person_t:#{current_user.login}\""
263
+ field_queries << "_query_:\"#{type}_access_person_t:#{user_key}\""
263
264
  end
264
265
  if current_user.is_being_superuser?(session)
265
266
  permission_types.each do |type|
@@ -269,7 +270,7 @@ module Hydra::AccessControlsEnforcement
269
270
 
270
271
  # if it is the depositor and it is under embargo, that is ok
271
272
  # otherwise if it not the depositor and it is under embargo, don't show it
272
- embargo_query = " OR ((_query_:\"embargo_release_date_dt:[NOW TO *]\" AND _query_:\"depositor_t:#{current_user.login}\") AND NOT (NOT _query_:\"depositor_t:#{current_user.login}\" AND _query_:\"embargo_release_date_dt:[NOW TO *]\"))"
273
+ embargo_query = " OR ((_query_:\"embargo_release_date_dt:[NOW TO *]\" AND _query_:\"depositor_t:#{user_key}\") AND NOT (NOT _query_:\"depositor_t:#{user_key}\" AND _query_:\"embargo_release_date_dt:[NOW TO *]\"))"
273
274
  end
274
275
 
275
276
  # remove anything with an embargo release date in the future
@@ -281,4 +282,5 @@ module Hydra::AccessControlsEnforcement
281
282
  return q
282
283
  end
283
284
 
285
+
284
286
  end
@@ -25,7 +25,7 @@ module Hydra::AccessControlsEvaluation
25
25
  user = "public"
26
26
  logger.debug("current_user is nil, assigning public")
27
27
  else
28
- user = current_user.login
28
+ user = user_key
29
29
  end
30
30
 
31
31
  user_groups = RoleMapper.roles(user)
@@ -4,12 +4,12 @@ module Hydra::AssetsControllerHelper
4
4
  # This makes sure that assets have the current user marked as their depositor/owner.
5
5
  # Relies on the asset's model to define _what_ apply_depositor_metadata should do. Most Hydra assets will rely on {Hydra::ModelMethods#apply_depositor_metadata}
6
6
  #
7
- # Attempts to call apply_depositor_metadata on the +asset+, passing current_user.login as the depositor
8
- # Does nothing if the asset doesn't respond to .apply_depositor_metadata or current_user doesn't respond to .login
7
+ # Attempts to call apply_depositor_metadata on the +asset+, passing user_key as the depositor
8
+ # Does nothing if the asset doesn't respond to .apply_depositor_metadata
9
9
  # @param asset to call apply_depositor_metadata on
10
10
  def apply_depositor_metadata(asset)
11
- if asset.respond_to?(:apply_depositor_metadata) && current_user.respond_to?(:login)
12
- asset.apply_depositor_metadata(current_user.login)
11
+ if asset.respond_to?(:apply_depositor_metadata) && user_key
12
+ asset.apply_depositor_metadata(user_key)
13
13
  end
14
14
  end
15
15
 
@@ -147,4 +147,4 @@ module Hydra::AssetsControllerHelper
147
147
  h
148
148
  end
149
149
 
150
- end
150
+ end
@@ -31,4 +31,9 @@ module Hydra::Controller
31
31
  javascript_includes << ['jquery.form.js']
32
32
  javascript_includes << ['spin.min.js' ]
33
33
  end
34
- end
34
+
35
+ def user_key
36
+ current_user.send(Devise.authentication_keys.first)
37
+ end
38
+
39
+ end
@@ -1,18 +1,4 @@
1
- require "hydra/testing_server"
2
-
3
- # if you would like to see solr startup messages on STDERR
4
- # when starting solr test server during functional tests use:
5
- #
6
- # rake SOLR_CONSOLE=true
7
- JETTY_PARAMS = {
8
- :quiet => ENV['HYDRA_CONSOLE'] ? false : true,
9
- :jetty_home => ENV['HYDRA_JETTY_HOME'],
10
- :jetty_port => 8983,
11
- :solr_home => ENV['HYDRA_SOLR_HOME'],
12
- :fedora_home => ENV['HYDRA_SOLR_HOME']
13
- }
14
-
15
- #:jetty_port => ENV['HYDRA_JETTY_PORT'],
1
+ require 'jettywrapper'
16
2
 
17
3
  namespace :jetty do
18
4
  desc "Apply all configs to Testing Server (relies on hydra:jetty:config tasks unless you override it)"
@@ -23,24 +9,6 @@ end
23
9
 
24
10
  namespace :hydra do
25
11
  namespace :jetty do
26
- desc "Starts the bundled Hydra Testing Server"
27
- task :start do
28
- Hydra::TestingServer.configure(JETTY_PARAMS)
29
- Hydra::TestingServer.instance.start
30
- end
31
-
32
- desc "Stops the bundled Hydra Testing Server"
33
- task :stop do
34
- Hydra::TestingServer.instance.stop
35
- end
36
-
37
- desc "Restarts the bundled Hydra Testing Server"
38
- task :restart do
39
- Hydra::TestingServer.instance.stop
40
- Hydra::TestingServer.configure(JETTY_PARAMS)
41
- Hydra::TestingServer.instance.start
42
- end
43
-
44
12
  desc "Copies the default Solr & Fedora configs into the bundled Hydra Testing Server"
45
13
  task :config do
46
14
  Rake::Task["hydra:jetty:config_fedora"].invoke
@@ -50,8 +18,8 @@ namespace :hydra do
50
18
  desc "Copies the contents of solr_conf into the Solr development-core and test-core of Testing Server"
51
19
  task :config_solr do
52
20
  FileList['solr_conf/*'].each do |f|
53
- cp_r("#{f}", 'jetty/solr/development-core/', :verbose => true)
54
- cp_r("#{f}", 'jetty/solr/test-core/', :verbose => true)
21
+ cp("#{f}", 'jetty/solr/development-core/', :verbose => true)
22
+ cp("#{f}", 'jetty/solr/test-core/', :verbose => true)
55
23
  end
56
24
  end
57
25
 
@@ -77,10 +45,5 @@ namespace :hydra do
77
45
  desc "Copies the default SOLR config files and starts up the fedora instance."
78
46
  task :load => [:config, :start]
79
47
 
80
- desc "Returns the status of the Hydra::TestingServer."
81
- task :status do
82
- status = Hydra::TestingServer.instance.pid ? "Running: #{Hydra::TestingServer.instance.pid}" : "Not running"
83
- puts status
84
- end
85
48
  end
86
49
  end
@@ -52,7 +52,7 @@ describe CatalogController do
52
52
  it "Should have Valid HTML when I'm logged in" do
53
53
 
54
54
  mock_user = mock("User")
55
- mock_user.stubs(:login).returns("archivist1@example.com")
55
+ mock_user.stubs(:email).returns("archivist1@example.com")
56
56
  mock_user.stubs(:can_be_superuser?).returns(true)
57
57
  mock_user.stubs(:is_being_superuser?).returns(true)
58
58
  mock_user.stubs(:last_search_url).returns(nil)
@@ -67,7 +67,7 @@ describe CatalogController do
67
67
 
68
68
  before(:each) do
69
69
  mock_user = mock("User")
70
- mock_user.stubs(:login).returns("archivist1@example.com")
70
+ mock_user.stubs(:email).returns("archivist1@example.com")
71
71
  mock_user.stubs(:can_be_superuser?).returns(true)
72
72
  mock_user.stubs(:is_being_superuser?).returns(true)
73
73
  mock_user.stubs(:last_search_url).returns(nil)
@@ -125,4 +125,4 @@ describe CatalogController do
125
125
 
126
126
  end #Document pages
127
127
 
128
- end
128
+ end
@@ -6,31 +6,19 @@ namespace :hyhead do
6
6
 
7
7
  desc "Execute Continuous Integration build (docs, tests with coverage)"
8
8
  task :ci do
9
- if ( ENV['environment'] == 'test' )
10
- Rake::Task["hyhead:doc"].invoke
11
- Rake::Task["hydra:jetty:config"].invoke
12
-
13
- require 'jettywrapper'
14
- jetty_params = {
15
- :jetty_home => File.expand_path(File.dirname(__FILE__) + '/../jetty'),
16
- :quiet => false,
17
- :jetty_port => 8983,
18
- :solr_home => File.expand_path(File.dirname(__FILE__) + '/../jetty/solr'),
19
- :fedora_home => File.expand_path(File.dirname(__FILE__) + '/../jetty/fedora/default'),
20
- :startup_wait => 30
21
- }
22
-
23
- # does this make jetty run in TEST environment???
24
- error = Jettywrapper.wrap(jetty_params) do
25
- Rake::Task['hyhead:setup_test_app'].invoke
26
- puts %x[rake hyhead:fixtures:refresh RAILS_ENV=test] # calling hydra:fixtures:refresh from the root of the test app
9
+ # Docs are broken
10
+ #Rake::Task["hyhead:doc"].invoke
11
+ Rake::Task["hydra:jetty:config"].invoke
12
+
13
+ require 'jettywrapper'
14
+ jetty_params = Jettywrapper.load_config.merge({:jetty_home => File.expand_path(File.dirname(__FILE__) + '/../jetty')})
15
+
16
+ error = nil
17
+ error = Jettywrapper.wrap(jetty_params) do
27
18
  Rake::Task['hyhead:test'].invoke
28
- end
29
- raise "test failures: #{error}" if error
30
- else
31
- system("rake hyhead:ci environment=test")
32
- fail unless $?.success?
19
+ Rake::Task['hyhead:cucumber'].invoke
33
20
  end
21
+ raise "test failures: #{error}" if error
34
22
  end
35
23
 
36
24
 
@@ -40,16 +28,19 @@ namespace :hyhead do
40
28
  namespace :rspec do
41
29
 
42
30
  desc "Run the hydra-head specs - need to have jetty running, test host set up and fixtures loaded."
43
- task :run => :use_test_app do
44
- puts "Running rspec tests"
45
- puts %x[rake hyhead:spec:run]
46
- FileUtils.cd('../../')
31
+ ENV['RAILS_ROOT'] = File.join(File.expand_path(File.dirname(__FILE__)),'..','tmp','test_app')
32
+ RSpec::Core::RakeTask.new(:run) do |t|
33
+ t.rspec_opts = "--colour"
34
+
35
+ # pattern directory name defaults to ./**/*_spec.rb, but has a more concise command line echo
36
+ t.pattern = File.join(File.expand_path(File.dirname(__FILE__)),'..','test_support','spec')
47
37
  end
48
38
 
39
+
49
40
  desc "Sets up test host, loads fixtures, then runs specs - need to have jetty running."
50
41
  task :setup_and_run => ["hyhead:setup_test_app"] do
51
42
  puts "Reloading fixtures"
52
- puts %x[rake hyhead:fixtures:refresh RAILS_ENV=test] # calling hydra:fixtures:refresh from the root of the test app
43
+ puts %x[rake hyhead:fixtures:refresh RAILS_ENV=test]
53
44
  Rake::Task["hyhead:rspec:run"].invoke
54
45
  end
55
46
 
@@ -99,16 +90,21 @@ namespace :hyhead do
99
90
 
100
91
 
101
92
  namespace :cucumber do
93
+
94
+ require 'cucumber/rake/task'
95
+
96
+ ### Don't call this directly, use hyhead:cucumber:run
97
+ Cucumber::Rake::Task.new(:cmd) do |t|
98
+ t.cucumber_opts = "../../test_support/features --format pretty"
99
+ end
102
100
 
103
- desc "Run cucumber tests for hyhead - need to have jetty running, test host set up and fixtures loaded."
104
- task :run => :set_test_host_path do
105
- Dir.chdir(TEST_HOST_PATH)
106
- puts "Running cucumber features in test host app"
107
- puts %x[rake hyhead:cucumber]
108
- # puts %x[cucumber --color --tags ~@pending --tags ~@overwritten features]
109
- raise "Cucumber tests failed" unless $?.success?
110
- FileUtils.cd('../../')
111
- end
101
+ desc "Run cucumber tests for hyhead - need to have jetty running, test host set up and fixtures loaded."
102
+ task :run => :set_test_host_path do
103
+ Dir.chdir(TEST_HOST_PATH)
104
+ puts "Running cucumber features in test host app"
105
+ Rake::Task["hyhead:cucumber:cmd"].invoke
106
+ FileUtils.cd('../../')
107
+ end
112
108
 
113
109
  # desc "Sets up test host, loads fixtures, then runs cucumber features - need to have jetty running."
114
110
  # task :setup_and_run => ["hyhead:setup_test_app", "hyhead:remove_features_from_host", "hyhead:copy_features_to_host"] do
@@ -218,26 +214,30 @@ namespace :hyhead do
218
214
  #
219
215
  # Test
220
216
  #
221
-
222
217
  desc "Run tests against test app"
223
- task :test => [:use_test_app] do
218
+ task :test => [:spec, :cucumber] do
224
219
 
225
- puts "Running rspec tests"
226
- puts %x[rake hyhead:spec]
227
- rspec_success = $?.success?
220
+ end
228
221
 
229
- puts "Running cucumber tests"
230
- puts %x[rake hyhead:cucumber]
231
- cucumber_success = $?.success?
222
+ # desc "Run tests against test app"
223
+ # task :test => [:use_test_app] do
224
+ #
225
+ # puts "Running rspec tests"
226
+ # puts %x[rake hyhead:spec]
227
+ # rspec_success = $?.success?
232
228
 
233
- FileUtils.cd('../../')
234
- if rspec_success && cucumber_success
235
- puts "Completed test suite with no errors"
236
- else
237
- puts "Test suite encountered failures... check console output for details."
238
- fail
239
- end
240
- end
229
+ # puts "Running cucumber tests"
230
+ # puts %x[rake hyhead:cucumber]
231
+ # cucumber_success = $?.success?
232
+
233
+ # FileUtils.cd('../../')
234
+ # if rspec_success && cucumber_success
235
+ # puts "Completed test suite with no errors"
236
+ # else
237
+ # puts "Test suite encountered failures... check console output for details."
238
+ # fail
239
+ # end
240
+ # end
241
241
 
242
242
  desc "Make sure the test app is installed, then run the tasks from its root directory"
243
243
  task :use_test_app => [:set_test_host_path] do
@@ -1,38 +1,9 @@
1
- require "hydra/testing_server"
1
+ ##For jettywrapper set the app_ROOT
2
+ APP_ROOT= File.expand_path(File.join(File.dirname(__FILE__),".."))
3
+ require 'jettywrapper'
2
4
 
3
- # if you would like to see solr startup messages on STDERR
4
- # when starting solr test server during functional tests use:
5
- #
6
- # rake SOLR_CONSOLE=true
7
- JETTY_PARAMS = {
8
- :quiet => ENV['HYDRA_CONSOLE'] ? false : true,
9
- :jetty_home => ENV['HYDRA_JETTY_HOME'],
10
- :jetty_port => 8983,
11
- :solr_home => ENV['HYDRA_SOLR_HOME'],
12
- :fedora_home => ENV['HYDRA_SOLR_HOME']
13
- }
14
-
15
- #:jetty_port => ENV['HYDRA_JETTY_PORT'],
16
5
  namespace :hydra do
17
6
  namespace :jetty do
18
- desc "Starts the bundled Hydra Testing Server"
19
- task :start do
20
- Hydra::TestingServer.configure(JETTY_PARAMS)
21
- Hydra::TestingServer.instance.start
22
- end
23
-
24
- desc "Stops the bundled Hydra Testing Server"
25
- task :stop do
26
- Hydra::TestingServer.instance.stop
27
- end
28
-
29
- desc "Restarts the bundled Hydra Testing Server"
30
- task :restart do
31
- Hydra::TestingServer.instance.stop
32
- Hydra::TestingServer.configure(JETTY_PARAMS)
33
- Hydra::TestingServer.instance.start
34
- end
35
-
36
7
  desc "Copies the default Solr & Fedora configs into the bundled Hydra Testing Server"
37
8
  task :config do
38
9
  Rake::Task["hydra:jetty:config_fedora"].invoke
@@ -44,7 +15,7 @@ namespace :hydra do
44
15
  FileList['solr_conf/conf/*'].each do |f|
45
16
  cp("#{f}", 'jetty/solr/development-core/conf/', :verbose => true)
46
17
  cp("#{f}", 'jetty/solr/test-core/conf/', :verbose => true)
47
- end
18
+ end
48
19
 
49
20
  end
50
21
 
@@ -68,12 +39,7 @@ namespace :hydra do
68
39
  end
69
40
 
70
41
  desc "Copies the default SOLR config files and starts up the fedora instance."
71
- task :load => [:config, :start]
42
+ task :load => [:config, 'jetty:start']
72
43
 
73
- desc "Returns the status of the Hydra::TestingServer."
74
- task :status do
75
- status = Hydra::TestingServer.instance.pid ? "Running: #{Hydra::TestingServer.instance.pid}" : "Not running"
76
- puts status
77
- end
78
44
  end
79
45
  end
@@ -12,6 +12,7 @@ gem 'sqlite3-ruby', '~>1.2.5', :require => 'sqlite3'
12
12
  gem 'blacklight', '3.0.0'
13
13
  gem 'hydra-head', :path => '../../'
14
14
  gem 'devise'
15
+ gem 'jettywrapper'
15
16
 
16
17
  # For testing
17
18
  group :development, :test do
@@ -22,6 +22,7 @@ Feature: HTML validity
22
22
  Given I am logged in as "archivist1@example.com"
23
23
  When I am on the home page
24
24
  And I follow "Article"
25
+ #This may fail if there are a lot of articles in fedora and the expected article is not on the first page
25
26
  Then I should see "TITLE OF HOST JOURNAL"
26
27
  And the page should be HTML5 valid
27
28
 
@@ -72,7 +72,7 @@ describe CatalogController do
72
72
  assigns(:document_list).count.should == @public_only_results.docs.count
73
73
  end
74
74
  it "should return all documents if role does have permissions" do
75
- User.any_instance.stubs(:login).returns("BigWig")
75
+ User.any_instance.stubs(:email).returns("BigWig@example.com")
76
76
  mock_user = User.new
77
77
  # session[:superuser_mode] = true
78
78
  mock_user.stubs(:is_being_superuser?).returns(true)
@@ -44,7 +44,7 @@ describe CatalogController do
44
44
  describe "edit" do
45
45
  it "should enforce edit permissions, redirecting to show action and resetting session context if user does not have edit permissions" do
46
46
  mock_user = mock("User")
47
- mock_user.stubs(:login).returns("patron1")
47
+ mock_user.stubs(:email).returns("patron1@example.com")
48
48
  mock_user.stubs(:is_being_superuser?).returns(false)
49
49
  controller.stubs(:current_user).returns(mock_user)
50
50
 
@@ -64,11 +64,7 @@ describe FileAssetsController do
64
64
  end
65
65
  end
66
66
 
67
- describe "index" do
68
- it "should be refined further!"
69
- end
70
67
  describe "new" do
71
- it "should return the file uploader view"
72
68
  it "should set :container_id to value of :container_id if available" do
73
69
  xhr :get, :new, :asset_id=>"_PID_"
74
70
  @controller.params[:asset_id].should == "_PID_"
@@ -78,7 +74,7 @@ describe FileAssetsController do
78
74
  describe "show" do
79
75
  it "should redirect to index view if current_user does not have read or edit permissions" do
80
76
  mock_user = mock("User")
81
- mock_user.stubs(:login).returns("fake_user")
77
+ mock_user.stubs(:email).returns("fake_user@example.com")
82
78
  mock_user.stubs(:is_being_superuser?).returns(false)
83
79
  controller.stubs(:current_user).returns(mock_user)
84
80
  get(:show, :id=>"hydrangea:fixture_file_asset1")
@@ -170,6 +166,7 @@ describe FileAssetsController do
170
166
  describe "create" do
171
167
  before :each do
172
168
  mock_user = mock("User")
169
+ mock_user.stubs(:email).returns('user@example.com')
173
170
  mock_warden = mock("Warden")
174
171
  mock_warden.stubs(:authenticate).returns(mock_user)
175
172
  request.env['warden'] = mock_warden
@@ -7,8 +7,7 @@ describe Hydra::AccessControlsEnforcement do
7
7
  before(:each) do
8
8
  @stub_user = User.new :email=>'archivist1@example.com'
9
9
  @stub_user.stubs(:is_being_superuser?).returns false
10
- @stub_user.stubs(:login).returns "fred"
11
- RoleMapper.stubs(:roles).with(@stub_user.login).returns(["archivist","researcher"])
10
+ RoleMapper.stubs(:roles).with(@stub_user.email).returns(["archivist","researcher"])
12
11
  helper.stubs(:current_user).returns(@stub_user)
13
12
  @solr_parameters = {}
14
13
  @user_parameters = {}
@@ -16,7 +15,7 @@ describe Hydra::AccessControlsEnforcement do
16
15
  it "should set query fields for the user id checking against the discover, access, read fields" do
17
16
  helper.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
18
17
  ["discover","edit","read"].each do |type|
19
- @solr_parameters[:fq].first.should match(/#{type}_access_person_t\:#{@stub_user.login}/)
18
+ @solr_parameters[:fq].first.should match(/#{type}_access_person_t\:#{@stub_user.email}/)
20
19
  end
21
20
  end
22
21
  it "should set query fields for all roles the user is a member of checking against the discover, access, read fields" do
@@ -33,17 +32,16 @@ describe Hydra::AccessControlsEnforcement do
33
32
  it "should allow content owners access to their embargoed content" do
34
33
  pending
35
34
  helper.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
36
- @solr_parameters[:fq].should include("(NOT embargo_release_date_dt:[NOW TO *]) OR depositor_t:#{@stub_user.login}")
35
+ @solr_parameters[:fq].should include("(NOT embargo_release_date_dt:[NOW TO *]) OR depositor_t:#{@stub_user.email}")
37
36
 
38
- # @solr_parameters[:fq].should include("embargo_release_date_dt:[NOW TO *] AND depositor_t:#{current_user.login}) AND NOT (NOT depositor_t:#{current_user.login} AND embargo_release_date_dt:[NOW TO *]")
37
+ # @solr_parameters[:fq].should include("embargo_release_date_dt:[NOW TO *] AND depositor_t:#{current_user.email}) AND NOT (NOT depositor_t:#{current_user.email} AND embargo_release_date_dt:[NOW TO *]")
39
38
  end
40
39
 
41
40
  describe "for superusers" do
42
41
  it "should return superuser access level" do
43
- stub_user = User.new
44
- stub_user.stubs(:login).returns "suzie"
42
+ stub_user = User.new(:email=>'suzie@example.com')
45
43
  stub_user.stubs(:is_being_superuser?).returns true
46
- RoleMapper.stubs(:roles).with(stub_user.login).returns(["archivist","researcher"])
44
+ RoleMapper.stubs(:roles).with(stub_user.email).returns(["archivist","researcher"])
47
45
  helper.stubs(:current_user).returns(stub_user)
48
46
  helper.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
49
47
  ["discover","edit","read"].each do |type|
@@ -51,10 +49,9 @@ describe Hydra::AccessControlsEnforcement do
51
49
  end
52
50
  end
53
51
  it "should not return superuser access to non-superusers" do
54
- stub_user = User.new
55
- stub_user.stubs(:login).returns "suzie"
52
+ stub_user = User.new(:email=>'suzie@example.com')
56
53
  stub_user.stubs(:is_being_superuser?).returns false
57
- RoleMapper.stubs(:roles).with(stub_user.login).returns(["archivist","researcher"])
54
+ RoleMapper.stubs(:roles).with(stub_user.email).returns(["archivist","researcher"])
58
55
  helper.stubs(:current_user).returns(stub_user)
59
56
  helper.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
60
57
  ["discover","edit","read"].each do |type|
@@ -87,9 +84,9 @@ describe Hydra::AccessControlsEnforcement do
87
84
  helper.stubs(:current_user).returns(stub_user)
88
85
  # This example assumes that archivist1 is in the archivist and researcher groups.
89
86
  # Tried stubbing RoleMapper.roles instead, but that broke 26 other tests because mocha fails to release the expectation.
90
- # RoleMapper.stubs(:roles).with(stub_user.login).returns(["archivist", "researcher"])
87
+ # RoleMapper.stubs(:roles).with(stub_user.email).returns(["archivist", "researcher"])
91
88
  query = helper.send(:build_lucene_query, "query_string")
92
- # RoleMapper.stubs(:roles).with(stub_user.login).returns(["archivist", "researcher"])
89
+ # RoleMapper.stubs(:roles).with(stub_user.email).returns(["archivist", "researcher"])
93
90
  # query = helper.send(:build_lucene_query, "string")
94
91
 
95
92
  ["discover","edit","read"].each do |type|
@@ -112,7 +109,7 @@ describe Hydra::AccessControlsEnforcement do
112
109
  helper.stubs(:current_user).returns(stub_user)
113
110
  query = helper.send(:build_lucene_query, "string")
114
111
  ["discover","edit","read"].each do |type|
115
- query.should match(/_query_\:\"#{type}_access_person_t\:#{stub_user.login}/)
112
+ query.should match(/_query_\:\"#{type}_access_person_t\:#{stub_user.email}/)
116
113
  end
117
114
  end
118
115
  describe "for superusers" do
@@ -4,7 +4,7 @@ describe Hydra::AccessControlsEvaluation do
4
4
 
5
5
  describe "test_permission" do
6
6
  it "should automatically add logged-in users to 'registered' group" do
7
- mock_user = mock("User", :login => "logged_in_person")
7
+ mock_user = mock("User", :email => "logged_in_person@example.com")
8
8
  helper.stubs(:read_groups).returns(["registered"])
9
9
  helper.stubs(:current_user).returns(nil)
10
10
  helper.test_permission(:read).should == false
@@ -15,7 +15,7 @@ describe Hydra::AccessControlsEvaluation do
15
15
 
16
16
  describe "editor?" do
17
17
  it "should return true if current_user.is_being_superuser? is true" do
18
- mock_user = mock("User", :login => "BigWig")
18
+ mock_user = mock("User", :email => "BigWig@example.com")
19
19
  mock_user.stubs(:is_being_superuser?).returns true
20
20
  helper.stubs(:current_user).returns mock_user
21
21
  helper.editor?.should be_true
@@ -25,7 +25,7 @@ describe Hydra::AccessControlsEvaluation do
25
25
  helper.editor?.should be_false
26
26
  end
27
27
  it "should return false if the session[:user] does not have an editor role" do
28
- mock_user = mock("User", :login=>"nobody_special")
28
+ mock_user = mock("User", :email=>"nobody_special@example.com")
29
29
  mock_user.stubs(:is_being_superuser?).returns(false)
30
30
  helper.stubs(:current_user).returns(mock_user)
31
31
  helper.editor?.should be_false
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-head
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1923832029
4
+ hash: 1923832031
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
9
  - 0
10
10
  - pre
11
- - 2
12
- version: 3.1.0.pre2
11
+ - 3
12
+ version: 3.1.0.pre3
13
13
  platform: ruby
14
14
  authors:
15
15
  - Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield, Justin Coyne & many more. See https://github.com/projecthydra/hydra-head/contributors
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-11-10 00:00:00 -08:00
20
+ date: 2011-11-11 00:00:00 -06:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -540,12 +540,12 @@ dependencies:
540
540
  requirements:
541
541
  - - ">="
542
542
  - !ruby/object:Gem::Version
543
- hash: 23
543
+ hash: 31
544
544
  segments:
545
545
  - 1
546
546
  - 0
547
- - 0
548
- version: 1.0.0
547
+ - 4
548
+ version: 1.0.4
549
549
  type: :development
550
550
  version_requirements: *id036
551
551
  - !ruby/object:Gem::Dependency
@@ -577,55 +577,25 @@ dependencies:
577
577
  type: :development
578
578
  version_requirements: *id038
579
579
  - !ruby/object:Gem::Dependency
580
- name: rspec
580
+ name: rspec-rails
581
581
  prerelease: false
582
582
  requirement: &id039 !ruby/object:Gem::Requirement
583
583
  none: false
584
584
  requirements:
585
585
  - - ">="
586
586
  - !ruby/object:Gem::Version
587
- hash: 15
587
+ hash: 19
588
588
  segments:
589
589
  - 2
590
+ - 7
590
591
  - 0
591
- - 0
592
- version: 2.0.0
592
+ version: 2.7.0
593
593
  type: :development
594
594
  version_requirements: *id039
595
- - !ruby/object:Gem::Dependency
596
- name: rspec-rails
597
- prerelease: false
598
- requirement: &id040 !ruby/object:Gem::Requirement
599
- none: false
600
- requirements:
601
- - - ">="
602
- - !ruby/object:Gem::Version
603
- hash: 15
604
- segments:
605
- - 2
606
- - 0
607
- - 0
608
- version: 2.0.0
609
- type: :development
610
- version_requirements: *id040
611
- - !ruby/object:Gem::Dependency
612
- name: rest-client
613
- prerelease: false
614
- requirement: &id041 !ruby/object:Gem::Requirement
615
- none: false
616
- requirements:
617
- - - ">="
618
- - !ruby/object:Gem::Version
619
- hash: 3
620
- segments:
621
- - 0
622
- version: "0"
623
- type: :development
624
- version_requirements: *id041
625
595
  - !ruby/object:Gem::Dependency
626
596
  name: mocha
627
597
  prerelease: false
628
- requirement: &id042 !ruby/object:Gem::Requirement
598
+ requirement: &id040 !ruby/object:Gem::Requirement
629
599
  none: false
630
600
  requirements:
631
601
  - - ">="
@@ -635,11 +605,11 @@ dependencies:
635
605
  - 0
636
606
  version: "0"
637
607
  type: :development
638
- version_requirements: *id042
608
+ version_requirements: *id040
639
609
  - !ruby/object:Gem::Dependency
640
610
  name: cucumber
641
611
  prerelease: false
642
- requirement: &id043 !ruby/object:Gem::Requirement
612
+ requirement: &id041 !ruby/object:Gem::Requirement
643
613
  none: false
644
614
  requirements:
645
615
  - - ">="
@@ -651,11 +621,11 @@ dependencies:
651
621
  - 5
652
622
  version: 0.8.5
653
623
  type: :development
654
- version_requirements: *id043
624
+ version_requirements: *id041
655
625
  - !ruby/object:Gem::Dependency
656
626
  name: cucumber-rails
657
627
  prerelease: false
658
- requirement: &id044 !ruby/object:Gem::Requirement
628
+ requirement: &id042 !ruby/object:Gem::Requirement
659
629
  none: false
660
630
  requirements:
661
631
  - - ">="
@@ -667,11 +637,11 @@ dependencies:
667
637
  - 0
668
638
  version: 1.0.0
669
639
  type: :development
670
- version_requirements: *id044
640
+ version_requirements: *id042
671
641
  - !ruby/object:Gem::Dependency
672
642
  name: gherkin
673
643
  prerelease: false
674
- requirement: &id045 !ruby/object:Gem::Requirement
644
+ requirement: &id043 !ruby/object:Gem::Requirement
675
645
  none: false
676
646
  requirements:
677
647
  - - ">="
@@ -681,11 +651,11 @@ dependencies:
681
651
  - 0
682
652
  version: "0"
683
653
  type: :development
684
- version_requirements: *id045
654
+ version_requirements: *id043
685
655
  - !ruby/object:Gem::Dependency
686
656
  name: factory_girl
687
657
  prerelease: false
688
- requirement: &id046 !ruby/object:Gem::Requirement
658
+ requirement: &id044 !ruby/object:Gem::Requirement
689
659
  none: false
690
660
  requirements:
691
661
  - - ">="
@@ -695,11 +665,11 @@ dependencies:
695
665
  - 0
696
666
  version: "0"
697
667
  type: :development
698
- version_requirements: *id046
668
+ version_requirements: *id044
699
669
  - !ruby/object:Gem::Dependency
700
670
  name: rake
701
671
  prerelease: false
702
- requirement: &id047 !ruby/object:Gem::Requirement
672
+ requirement: &id045 !ruby/object:Gem::Requirement
703
673
  none: false
704
674
  requirements:
705
675
  - - ">="
@@ -709,7 +679,7 @@ dependencies:
709
679
  - 0
710
680
  version: "0"
711
681
  type: :development
712
- version_requirements: *id047
682
+ version_requirements: *id045
713
683
  description: "Hydra-Head is a Rails Engine containing the core code for a Hydra application. The full hydra stack includes: Blacklight, Fedora, Solr, active-fedora, solrizer, and om"
714
684
  email:
715
685
  - hydra-tech@googlegroups.com
@@ -1198,7 +1168,7 @@ files:
1198
1168
  - vendor/cache/httparty-0.8.1.gem
1199
1169
  - vendor/cache/httpi-0.9.5.gem
1200
1170
  - vendor/cache/i18n-0.5.0.gem
1201
- - vendor/cache/jettywrapper-1.0.2.gem
1171
+ - vendor/cache/jettywrapper-1.0.4.gem
1202
1172
  - vendor/cache/json-1.6.1.gem
1203
1173
  - vendor/cache/json_pure-1.6.1.gem
1204
1174
  - vendor/cache/kaminari-0.12.4.gem
@@ -1231,11 +1201,11 @@ files:
1231
1201
  - vendor/cache/rest-client-1.6.7.gem
1232
1202
  - vendor/cache/rsolr-1.0.2.gem
1233
1203
  - vendor/cache/rsolr-ext-1.0.3.gem
1234
- - vendor/cache/rspec-2.6.0.gem
1235
- - vendor/cache/rspec-core-2.6.4.gem
1236
- - vendor/cache/rspec-expectations-2.6.0.gem
1237
- - vendor/cache/rspec-mocks-2.6.0.gem
1238
- - vendor/cache/rspec-rails-2.6.1.gem
1204
+ - vendor/cache/rspec-2.7.0.gem
1205
+ - vendor/cache/rspec-core-2.7.1.gem
1206
+ - vendor/cache/rspec-expectations-2.7.0.gem
1207
+ - vendor/cache/rspec-mocks-2.7.0.gem
1208
+ - vendor/cache/rspec-rails-2.7.0.gem
1239
1209
  - vendor/cache/ruby-debug-0.10.4.gem
1240
1210
  - vendor/cache/ruby-debug-base-0.10.4.gem
1241
1211
  - vendor/cache/rubydora-0.2.3.gem
Binary file
Binary file
Binary file
Binary file
Binary file