spotlight-dor-resources 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26c9986fe02749baef5e222fbd5307aaed238473
4
- data.tar.gz: 211ec782a3c90f62010857c8d5467c7d091d470d
3
+ metadata.gz: 182216d0851743e3b7309ddc05271a0ba7c16cea
4
+ data.tar.gz: 21bf71fe88cb1e52a766404f60476519eddbe6f9
5
5
  SHA512:
6
- metadata.gz: 59b9799e167ce1e845a32700a305f33677d65c4795690da1fc97cc3a6be4eb2e5d7e257b3fbf88598a5a2f8e4521b7a51856d9a39a03caf61cbe9cf7d0f2c64c
7
- data.tar.gz: d6bc026eae7dffe3b4c7e3579028b5c0140a3cf4e3afd78a730515502327fcf5f298c1b5b12445661126b52782d0fd878f1a2a1abc76a8978d3ce379d6fc15e2
6
+ metadata.gz: bd1fd4bfe26544a6e344d0195abb4c74bc8ced7cc8bf70e7a910926c08e48ed8928a90cf1429dab4c7022398d2f149ad6cbf483fad54a0a34681abb0dbd94f6a
7
+ data.tar.gz: 4fa9a09684202c7894f99f00cfb5bb2c10c7db5475c8adf3b19a257ce1e1d442228db2ea753d2746af52b50cb580f1961939376b5ec6218210802f8de702c7bd
@@ -1,3 +1,25 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-07-07 21:30:11 -0500 using RuboCop version 0.41.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
1
8
 
2
- Style/ClassAndModuleChildren:
3
- Enabled: false
9
+ # Offense count: 1
10
+ Lint/UselessAccessModifier:
11
+ Exclude:
12
+ - 'lib/spotlight/dor/indexer.rb'
13
+
14
+ # Offense count: 7
15
+ # Configuration parameters: Max.
16
+ RSpec/ExampleLength:
17
+ Exclude:
18
+ - 'spec/lib/spotlight/dor/indexer_spec.rb'
19
+ - 'spec/models/spotlight/resources/dor_harvester_spec.rb'
20
+
21
+ # Offense count: 2
22
+ RSpec/VerifiedDoubles:
23
+ Exclude:
24
+ - 'spec/integration/gdor_integration_spec.rb'
25
+ - 'spec/models/spotlight/resources/dor_harvester_spec.rb'
@@ -2,14 +2,16 @@ notifications:
2
2
  email: false
3
3
 
4
4
  rvm:
5
- - 2.2.3
6
-
5
+ - 2.3.1
7
6
  env:
8
7
  global:
9
8
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
9
+ - RAILS_VERSION=4.2.6
10
10
 
11
11
  sudo: false
12
12
  language: ruby
13
13
 
14
14
  script:
15
15
  - bundle exec rake
16
+
17
+ jdk: oraclejdk8
data/Gemfile CHANGED
@@ -13,10 +13,10 @@ group :test do
13
13
  end
14
14
 
15
15
  # BEGIN ENGINE_CART BLOCK
16
- # engine_cart: 0.8.0
17
- # engine_cart stanza: 0.8.0
16
+ # engine_cart: 0.10.0
17
+ # engine_cart stanza: 0.10.0
18
18
  # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
19
- file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
19
+ file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
20
20
  if File.exist?(file)
21
21
  begin
22
22
  eval_gemfile file
@@ -27,13 +27,22 @@ if File.exist?(file)
27
27
  else
28
28
  Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
29
29
 
30
- gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
30
+ if ENV['RAILS_VERSION']
31
+ if ENV['RAILS_VERSION'] == 'edge'
32
+ gem 'rails', github: 'rails/rails'
33
+ ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
34
+ else
35
+ gem 'rails', ENV['RAILS_VERSION']
36
+ end
37
+ end
31
38
 
32
- if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
33
- gem 'responders', "~> 2.0"
34
- gem 'sass-rails', ">= 5.0"
35
- else
36
- gem 'sass-rails', "< 5.0"
39
+ case ENV['RAILS_VERSION']
40
+ when /^4.2/
41
+ gem 'responders', '~> 2.0'
42
+ gem 'sass-rails', '>= 5.0'
43
+ gem 'coffee-rails', '~> 4.1.0'
44
+ when /^4.[01]/
45
+ gem 'sass-rails', '< 5.0'
37
46
  end
38
47
  end
39
48
  # END ENGINE_CART BLOCK
data/README.md CHANGED
@@ -25,7 +25,7 @@ Within a Spotlight application with `spotlight-dor-resources` installed, you cou
25
25
  Note that Spotlight:
26
26
 
27
27
  * is a Rails engine and needs to be used in the context of a Rails application. We use [engine_cart](https://github.com/cbeer/engine_cart) to create an internal test application at .internal_test_app.
28
- * uses Solr as part of its integration tests. We use [jettywrapper](https://github.com/projecthydra/jettywrapper) to manage the Solr instance used for development and test.
28
+ * uses Solr as part of its integration tests. We use [solr_wrapper](https://github.com/cbeer/solr_wrapper) to manage the Solr instance used for development and test.
29
29
 
30
30
  Our `$ rake ci` task utilizes Solr and the testing rails app, with Spotlight installed, automatically.
31
31
 
@@ -40,9 +40,7 @@ This will download a test jetty instance (to run Solr), generate a testing app a
40
40
 
41
41
  ### Indexing with the generated test app
42
42
 
43
- $ rake exhibits:configure_solr
44
- $ rake jetty:clean
45
- $ rake jetty:start
43
+ $ solr_wrapper
46
44
  $ bundle exec rake engine_cart:console
47
45
 
48
46
  ```ruby
data/Rakefile CHANGED
@@ -4,8 +4,6 @@ rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
- ZIP_URL = 'https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip'
8
-
9
7
  Bundler::GemHelper.install_tasks
10
8
 
11
9
  task default: [:ci, :rubocop]
@@ -16,19 +14,17 @@ RSpec::Core::RakeTask.new(:spec)
16
14
  require 'rubocop/rake_task'
17
15
  RuboCop::RakeTask.new(:rubocop)
18
16
 
19
- require 'jettywrapper'
20
17
  require 'engine_cart/rake_task'
21
- require 'exhibits_solr_conf'
22
18
  desc 'Run tests in generated test Rails app with generated Solr instance running'
23
- task ci: ['engine_cart:generate', 'jetty:clean', 'exhibits:configure_solr'] do
19
+ task ci: ['engine_cart:generate'] do
20
+ require 'solr_wrapper'
21
+ require 'exhibits_solr_conf'
24
22
  ENV['environment'] = 'test'
25
- ENV['TEST_JETTY_PORT'] = '8983'
26
- jetty_params = Jettywrapper.load_config
27
- jetty_params[:startup_wait] = 60
28
-
29
- Jettywrapper.wrap(jetty_params) do
30
- # run the tests
31
- Rake::Task['spec'].invoke
23
+ SolrWrapper.wrap(port: '8983') do |solr|
24
+ solr.with_collection(name: 'blacklight-core', dir: ExhibitsSolrConf.path) do
25
+ # run the tests
26
+ Rake::Task['spec'].invoke
27
+ end
32
28
  end
33
29
  end
34
30
 
@@ -12,21 +12,12 @@ module Spotlight::Resources
12
12
  @resource.update(resource_params)
13
13
 
14
14
  if @resource.save_and_index
15
- redirect_to spotlight.admin_exhibit_catalog_index_path(current_exhibit)
16
- else
17
- redirect_to spotlight.new_exhibit_resource_path(current_exhibit)
18
- end
19
- end
20
-
21
- def update
22
- @resource.update(resource_params)
23
-
24
- if @resource.save_and_index
25
- redirect_to spotlight.admin_exhibit_catalog_index_path(current_exhibit)
15
+ redirect_to spotlight.admin_exhibit_catalog_path(current_exhibit)
26
16
  else
27
17
  redirect_to spotlight.new_exhibit_resource_path(current_exhibit)
28
18
  end
29
19
  end
20
+ alias update create
30
21
 
31
22
  private
32
23
 
@@ -2,7 +2,7 @@ module Spotlight
2
2
  module Dor
3
3
  # :nodoc:
4
4
  module Resources
5
- VERSION = '1.0.1'
5
+ VERSION = '1.1.0'.freeze
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Spotlight::Resources::DorHarvesterController, type: :controller do
4
+ routes { Spotlight::Dor::Resources::Engine.routes }
5
+ let(:resource) { double }
6
+ let(:exhibit) { FactoryGirl.create(:exhibit) }
7
+ let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
8
+ let(:attributes) { { druid_list: '' } }
9
+
10
+ before do
11
+ sign_in user
12
+ allow(Spotlight::Resources::DorHarvester).to receive(:instance).and_return(resource)
13
+ end
14
+
15
+ describe '#create' do
16
+ before do
17
+ expect(resource).to receive(:update).with(attributes)
18
+ allow(resource).to receive(:save_and_index).and_return(save_status)
19
+ end
20
+
21
+ context 'when save is successful' do
22
+ let(:save_status) { true }
23
+
24
+ it 'goes to the exhibit' do
25
+ post :create, exhibit_id: exhibit.id, resources_dor_harvester: attributes
26
+
27
+ expect(response).to redirect_to Spotlight::Engine.routes.url_helpers.admin_exhibit_catalog_path(exhibit)
28
+ end
29
+ end
30
+
31
+ context 'when save is unsuccessful' do
32
+ let(:save_status) { false }
33
+
34
+ it 'goes to the exhibit' do
35
+ post :create, exhibit_id: exhibit.id, resources_dor_harvester: attributes
36
+
37
+ expect(response).to redirect_to Spotlight::Engine.routes.url_helpers.new_exhibit_resource_path(exhibit)
38
+ end
39
+ end
40
+ end
41
+
42
+ describe '#update' do
43
+ before do
44
+ expect(resource).to receive(:update).with(attributes)
45
+ allow(resource).to receive(:save_and_index).and_return(save_status)
46
+ end
47
+
48
+ context 'when save is successful' do
49
+ let(:save_status) { true }
50
+
51
+ it 'goes to the exhibit' do
52
+ patch :update, exhibit_id: exhibit.id, resources_dor_harvester: attributes
53
+
54
+ expect(response).to redirect_to Spotlight::Engine.routes.url_helpers.admin_exhibit_catalog_path(exhibit)
55
+ end
56
+ end
57
+
58
+ context 'when save is unsuccessful' do
59
+ let(:save_status) { false }
60
+
61
+ it 'goes to the exhibit' do
62
+ patch :update, exhibit_id: exhibit.id, resources_dor_harvester: attributes
63
+
64
+ expect(response).to redirect_to Spotlight::Engine.routes.url_helpers.new_exhibit_resource_path(exhibit)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -3,28 +3,31 @@ ENV["RAILS_ENV"] ||= 'test'
3
3
  require 'devise'
4
4
  require 'engine_cart'
5
5
  require 'vcr'
6
+
7
+ if ENV["COVERAGE"] or ENV["CI"]
8
+ require 'simplecov'
9
+ require 'coveralls' if ENV["CI"]
10
+
11
+ SimpleCov.root(File.expand_path('../..', __FILE__))
12
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter if ENV["CI"]
13
+ SimpleCov.start('rails') do
14
+ add_filter '/.internal_test_app'
15
+ add_filter '/lib/generators'
16
+ add_filter '/spec'
17
+ end
18
+ SimpleCov.command_name 'spec'
19
+ end
20
+
6
21
  EngineCart.load_application!
7
22
 
8
23
  require 'rspec/rails'
9
24
  require 'capybara'
10
-
11
25
  require 'factory_girl_rails'
12
26
  FactoryGirl.definition_file_paths ||= []
13
27
  FactoryGirl.definition_file_paths << "#{Gem.loaded_specs['blacklight-spotlight'].full_gem_path}/spec/factories"
14
28
  FactoryGirl.find_definitions
15
29
 
16
30
  require 'database_cleaner'
17
-
18
- if ENV["COVERAGE"] or ENV["CI"]
19
- require 'simplecov'
20
- require 'coveralls' if ENV["CI"]
21
-
22
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter if ENV["CI"]
23
- SimpleCov.start do
24
- add_filter "/spec/"
25
- end
26
- end
27
-
28
31
  require 'spotlight'
29
32
 
30
33
 
@@ -12,7 +12,7 @@ class TestAppGenerator < Rails::Generators::Base
12
12
 
13
13
  def run_blacklight_generator
14
14
  say_status('warning', 'GENERATING BL', :yellow)
15
- generate 'blacklight:install', '--devise --jettywrapper'
15
+ generate 'blacklight:install', '--devise'
16
16
  end
17
17
 
18
18
  def run_spotlight_migrations
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  # newer versions of harvestdor-indexer have performance improvements for collections
27
27
  spec.add_dependency 'harvestdor-indexer', '~> 2.3'
28
28
  spec.add_dependency 'rails'
29
- spec.add_dependency 'blacklight-spotlight', '~> 0.16'
29
+ spec.add_dependency 'blacklight-spotlight', '~> 0.18'
30
30
  spec.add_dependency 'parallel'
31
31
  spec.add_dependency 'stanford-mods', '~> 2.1'
32
32
  spec.add_development_dependency 'bundler', '~> 1.5'
@@ -36,10 +36,10 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'capybara'
37
37
  spec.add_development_dependency 'vcr', '~> 3.0'
38
38
  spec.add_development_dependency 'webmock'
39
- spec.add_development_dependency 'jettywrapper'
39
+ spec.add_development_dependency 'solr_wrapper'
40
40
  spec.add_development_dependency 'engine_cart', '~> 0.8'
41
41
  spec.add_development_dependency 'database_cleaner'
42
- spec.add_development_dependency 'exhibits_solr_conf'
42
+ spec.add_development_dependency 'exhibits_solr_conf', '~> 0.1'
43
43
  spec.add_development_dependency 'factory_girl_rails'
44
44
  spec.add_development_dependency 'rubocop', '~> 0.36'
45
45
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotlight-dor-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.16'
89
+ version: '0.18'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.16'
96
+ version: '0.18'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: parallel
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -221,7 +221,7 @@ dependencies:
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: jettywrapper
224
+ name: solr_wrapper
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
@@ -266,16 +266,16 @@ dependencies:
266
266
  name: exhibits_solr_conf
267
267
  requirement: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - ">="
269
+ - - "~>"
270
270
  - !ruby/object:Gem::Version
271
- version: '0'
271
+ version: '0.1'
272
272
  type: :development
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
- - - ">="
276
+ - - "~>"
277
277
  - !ruby/object:Gem::Version
278
- version: '0'
278
+ version: '0.1'
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: factory_girl_rails
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -344,6 +344,7 @@ files:
344
344
  - lib/spotlight/dor/resources.rb
345
345
  - lib/spotlight/dor/resources/engine.rb
346
346
  - lib/spotlight/dor/resources/version.rb
347
+ - spec/controllers/spotlight/resources/dor_harvester_controller_spec.rb
347
348
  - spec/integration/gdor_integration_spec.rb
348
349
  - spec/lib/spotlight/dor/indexer_spec.rb
349
350
  - spec/models/spotlight/resources/dor_harvester_spec.rb
@@ -376,11 +377,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
376
377
  version: '0'
377
378
  requirements: []
378
379
  rubyforge_project:
379
- rubygems_version: 2.4.5.1
380
+ rubygems_version: 2.5.1
380
381
  signing_key:
381
382
  specification_version: 4
382
383
  summary: Spotlight resource indexer for DOR resources.
383
384
  test_files:
385
+ - spec/controllers/spotlight/resources/dor_harvester_controller_spec.rb
384
386
  - spec/integration/gdor_integration_spec.rb
385
387
  - spec/lib/spotlight/dor/indexer_spec.rb
386
388
  - spec/models/spotlight/resources/dor_harvester_spec.rb