blacklight_cql 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/VERSION +1 -1
  2. data/app/views/blacklight_cql/{explain/explain.xml.builder → explain.xml.builder} +3 -5
  3. data/lib/blacklight_cql/engine.rb +2 -11
  4. data/lib/blacklight_cql/explain_behavior.rb +14 -0
  5. data/spec/internal/Gemfile +50 -0
  6. data/spec/internal/Gemfile.lock +157 -0
  7. data/spec/internal/README.rdoc +28 -0
  8. data/spec/internal/Rakefile +6 -0
  9. data/spec/internal/app/assets/javascripts/application.js +16 -0
  10. data/spec/internal/app/assets/stylesheets/application.css +13 -0
  11. data/spec/internal/app/controllers/application_controller.rb +3 -2
  12. data/spec/internal/app/helpers/application_helper.rb +2 -0
  13. data/spec/internal/app/views/layouts/application.html.erb +14 -0
  14. data/spec/internal/bin/bundle +3 -0
  15. data/spec/internal/bin/rails +4 -0
  16. data/spec/internal/bin/rake +4 -0
  17. data/spec/internal/config.ru +4 -0
  18. data/spec/internal/config/application.rb +23 -0
  19. data/spec/internal/config/boot.rb +4 -0
  20. data/spec/internal/config/database.yml +24 -2
  21. data/spec/internal/config/environment.rb +5 -0
  22. data/spec/internal/config/environments/development.rb +29 -0
  23. data/spec/internal/config/environments/production.rb +80 -0
  24. data/spec/internal/config/environments/test.rb +36 -0
  25. data/spec/internal/config/initializers/backtrace_silencers.rb +7 -0
  26. data/spec/internal/config/initializers/filter_parameter_logging.rb +4 -0
  27. data/spec/internal/config/initializers/inflections.rb +16 -0
  28. data/spec/internal/config/initializers/mime_types.rb +5 -0
  29. data/spec/internal/config/initializers/secret_token.rb +12 -0
  30. data/spec/internal/config/initializers/session_store.rb +3 -0
  31. data/spec/internal/config/initializers/wrap_parameters.rb +14 -0
  32. data/spec/internal/config/locales/en.yml +23 -0
  33. data/spec/internal/config/routes.rb +53 -3
  34. data/spec/internal/db/{combustion_test.sqlite → development.sqlite3} +0 -0
  35. data/spec/internal/db/schema.rb +2 -39
  36. data/spec/internal/db/seeds.rb +7 -0
  37. data/spec/internal/db/test.sqlite3 +0 -0
  38. data/spec/internal/lib/generators/test_app_generator.rb +8 -0
  39. data/spec/internal/log/development.log +7 -0
  40. data/spec/internal/log/test.log +2 -0
  41. data/spec/internal/public/404.html +58 -0
  42. data/spec/internal/public/422.html +58 -0
  43. data/spec/internal/public/500.html +57 -0
  44. data/spec/internal/public/robots.txt +5 -0
  45. data/spec/internal/test/test_helper.rb +15 -0
  46. data/spec/spec_helper.rb +7 -11
  47. data/spec/test_app_templates/Gemfile.extra +1 -0
  48. data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -0
  49. data/spec/views/explain.xml.builder_spec.rb +8 -8
  50. metadata +102 -15
  51. data/app/controllers/blacklight_cql/explain_controller.rb +0 -17
  52. data/lib/blacklight_cql/route_sets.rb +0 -19
  53. data/spec/internal/app/models/solr_document.rb +0 -3
  54. data/spec/internal/config/solr.yml +0 -18
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
@@ -0,0 +1,15 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ ActiveRecord::Migration.check_pending!
7
+
8
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9
+ #
10
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
11
+ # -- they do not yet inherit this setting
12
+ fixtures :all
13
+
14
+ # Add more helper methods to be used by all tests here...
15
+ end
@@ -7,11 +7,10 @@ Bundler.require :default, :development
7
7
  # Set the default environment to sqlite3's in_memory database
8
8
  ENV['RAILS_ENV'] ||= 'test'
9
9
 
10
-
11
- require 'blacklight/engine'
12
- Combustion.initialize!
10
+ EngineCart.load_application!
13
11
 
14
12
  require 'rspec/rails'
13
+ require 'rspec/autorun'
15
14
  require 'capybara/rspec'
16
15
  require 'capybara/rails'
17
16
 
@@ -25,8 +24,9 @@ MARC_DATA_PATH = "#{File.dirname(__FILE__)}/marc_data"
25
24
  # Undo changes to RAILS_ENV
26
25
  silence_warnings {RAILS_ENV = ENV['RAILS_ENV']}
27
26
 
28
- # Run the migrations
29
- ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
27
+ # Checks for pending migrations before tests are run.
28
+ # If you are not using ActiveRecord, you can remove this line.
29
+ ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
30
30
 
31
31
 
32
32
  RSpec.configure do |config|
@@ -40,17 +40,13 @@ RSpec.configure do |config|
40
40
  config.mock_with :rspec
41
41
 
42
42
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
43
- config.fixture_path = "#{File.expand_path(File.dirname(__FILE__))}/spec/fixtures"
43
+ #config.fixture_path = "#{::Rails.root}/spec/fixtures"
44
44
 
45
45
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
46
46
  # examples within a transaction, remove the following line or assign false
47
47
  # instead of true.
48
- config.use_transactional_fixtures = true
48
+ #config.use_transactional_fixtures = true
49
49
 
50
- # If true, the base class of anonymous controllers will be inferred
51
- # automatically. This will be the default behavior in future versions of
52
- # rspec-rails.
53
- config.infer_base_class_for_anonymous_controllers = false
54
50
 
55
51
 
56
52
  ##
@@ -0,0 +1 @@
1
+ # extra gems to load into the test app go here
@@ -0,0 +1,8 @@
1
+ require 'rails/generators'
2
+
3
+ class TestAppGenerator < Rails::Generators::Base
4
+ source_root "spec/test_app_templates"
5
+
6
+
7
+ end
8
+
@@ -8,13 +8,13 @@ describe "SRU/ZeeRex explain view" do
8
8
  # no docs actually told me to do this, I just made it up. hell if I know
9
9
  # just trying to figure out how to make tests work.
10
10
  Rails.application.routes.draw do
11
- match ':controller(/:action(/:id(.:format)))'
11
+ get ':controller(/:action(/:id(.:format)))'
12
12
  end
13
13
  end
14
14
 
15
15
  before do
16
16
 
17
- assign(:config,
17
+ @config =
18
18
  Blacklight::Configuration.new do |conf|
19
19
  conf.add_search_field("title") do
20
20
  solr_parameters = {:qf => "something"}
@@ -26,13 +26,13 @@ describe "SRU/ZeeRex explain view" do
26
26
  end
27
27
 
28
28
  end
29
- )
30
29
 
31
- assign(:luke_response,
30
+
31
+ @luke_response =
32
32
  YAML::load( File.open( File.expand_path(File.dirname(__FILE__) + '/../data/luke.yaml') ) )
33
- )
33
+
34
34
 
35
- render :template => "blacklight_cql/explain/explain", :formats => [:xml]
35
+ render :template => "blacklight_cql/explain", :formats => [:xml]
36
36
  @rendered_xml = Nokogiri::XML(rendered.to_s)
37
37
  @ns = {"ex" => "http://explain.z3950.org/dtd/2.0/"}
38
38
 
@@ -64,9 +64,9 @@ describe "SRU/ZeeRex explain view" do
64
64
  server_info.at_xpath("./ex:host[text()='test.host']", "ex" => "http://explain.z3950.org/dtd/2.0/").should_not be_nil
65
65
  server_info.at_xpath("./ex:port[text()='80']", "ex" => "http://explain.z3950.org/dtd/2.0/").should_not be_nil
66
66
 
67
- explain_url = url_for(:controller => "/catalog", :action => "index", :search_field => BlacklightCql::SolrHelperExtension.pseudo_search_field[:key])
67
+ explain_url = url_for(:only_path => false, :action => "index", :search_field => BlacklightCql::SolrHelperExtension.pseudo_search_field[:key])
68
68
 
69
- server_info.at_xpath("./ex:database[text()='#{explain_url}']", "ex" => "http://explain.z3950.org/dtd/2.0/").should_not be_nil
69
+ expect(server_info.at_xpath("./ex:database", "ex" => "http://explain.z3950.org/dtd/2.0/").text()).to eq(explain_url)
70
70
  end
71
71
 
72
72
  it "should include an indexInfo with context set prefixes" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_cql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-06 00:00:00.000000000 Z
12
+ date: 2014-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '3.0'
21
+ version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '3.0'
29
+ version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: blacklight
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -113,6 +113,22 @@ dependencies:
113
113
  - - ! '>='
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: engine_cart
118
+ requirement: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
116
132
  description:
117
133
  email:
118
134
  - blacklight-development@googlegroups.com
@@ -122,31 +138,66 @@ extra_rdoc_files: []
122
138
  files:
123
139
  - lib/blacklight_cql/blacklight_to_solr.rb
124
140
  - lib/blacklight_cql/engine.rb
125
- - lib/blacklight_cql/route_sets.rb
141
+ - lib/blacklight_cql/explain_behavior.rb
126
142
  - lib/blacklight_cql/solr_helper_extension.rb
127
143
  - lib/blacklight_cql/template_helper_extension.rb
128
144
  - lib/blacklight_cql/version.rb
129
145
  - lib/blacklight_cql.rb
130
- - app/controllers/blacklight_cql/explain_controller.rb
131
146
  - app/helpers/blacklight_cql/explain_helper.rb
132
- - app/views/blacklight_cql/explain/explain.xml.builder
147
+ - app/views/blacklight_cql/explain.xml.builder
133
148
  - VERSION
134
149
  - spec/data/luke.yaml
135
150
  - spec/data/zeerex-2.0.xsd
151
+ - spec/internal/app/assets/javascripts/application.js
152
+ - spec/internal/app/assets/stylesheets/application.css
136
153
  - spec/internal/app/controllers/application_controller.rb
137
- - spec/internal/app/models/solr_document.rb
154
+ - spec/internal/app/helpers/application_helper.rb
155
+ - spec/internal/app/views/layouts/application.html.erb
156
+ - spec/internal/bin/bundle
157
+ - spec/internal/bin/rails
158
+ - spec/internal/bin/rake
159
+ - spec/internal/config/application.rb
160
+ - spec/internal/config/boot.rb
138
161
  - spec/internal/config/database.yml
162
+ - spec/internal/config/environment.rb
163
+ - spec/internal/config/environments/development.rb
164
+ - spec/internal/config/environments/production.rb
165
+ - spec/internal/config/environments/test.rb
166
+ - spec/internal/config/initializers/backtrace_silencers.rb
167
+ - spec/internal/config/initializers/filter_parameter_logging.rb
168
+ - spec/internal/config/initializers/inflections.rb
169
+ - spec/internal/config/initializers/mime_types.rb
170
+ - spec/internal/config/initializers/secret_token.rb
171
+ - spec/internal/config/initializers/session_store.rb
172
+ - spec/internal/config/initializers/wrap_parameters.rb
173
+ - spec/internal/config/locales/en.yml
139
174
  - spec/internal/config/routes.rb
140
- - spec/internal/config/solr.yml
141
- - spec/internal/db/combustion_test.sqlite
175
+ - spec/internal/config.ru
176
+ - spec/internal/db/development.sqlite3
142
177
  - spec/internal/db/schema.rb
178
+ - spec/internal/db/seeds.rb
179
+ - spec/internal/db/test.sqlite3
180
+ - spec/internal/Gemfile
181
+ - spec/internal/Gemfile.lock
182
+ - spec/internal/lib/generators/test_app_generator.rb
183
+ - spec/internal/log/development.log
184
+ - spec/internal/log/test.log
185
+ - spec/internal/public/404.html
186
+ - spec/internal/public/422.html
187
+ - spec/internal/public/500.html
143
188
  - spec/internal/public/favicon.ico
189
+ - spec/internal/public/robots.txt
190
+ - spec/internal/Rakefile
191
+ - spec/internal/README.rdoc
192
+ - spec/internal/test/test_helper.rb
144
193
  - spec/lib/blacklight_to_solr_spec.rb
145
194
  - spec/marc_data/chomsky.mrc
146
195
  - spec/marc_data/social_journal.mrc
147
196
  - spec/rcov.opts
148
197
  - spec/spec.opts
149
198
  - spec/spec_helper.rb
199
+ - spec/test_app_templates/Gemfile.extra
200
+ - spec/test_app_templates/lib/generators/test_app_generator.rb
150
201
  - spec/views/explain.xml.builder_spec.rb
151
202
  homepage: http://projectblacklight.org/
152
203
  licenses: []
@@ -175,19 +226,55 @@ summary: Blacklight CQL plugin
175
226
  test_files:
176
227
  - spec/data/luke.yaml
177
228
  - spec/data/zeerex-2.0.xsd
229
+ - spec/internal/app/assets/javascripts/application.js
230
+ - spec/internal/app/assets/stylesheets/application.css
178
231
  - spec/internal/app/controllers/application_controller.rb
179
- - spec/internal/app/models/solr_document.rb
232
+ - spec/internal/app/helpers/application_helper.rb
233
+ - spec/internal/app/views/layouts/application.html.erb
234
+ - spec/internal/bin/bundle
235
+ - spec/internal/bin/rails
236
+ - spec/internal/bin/rake
237
+ - spec/internal/config/application.rb
238
+ - spec/internal/config/boot.rb
180
239
  - spec/internal/config/database.yml
240
+ - spec/internal/config/environment.rb
241
+ - spec/internal/config/environments/development.rb
242
+ - spec/internal/config/environments/production.rb
243
+ - spec/internal/config/environments/test.rb
244
+ - spec/internal/config/initializers/backtrace_silencers.rb
245
+ - spec/internal/config/initializers/filter_parameter_logging.rb
246
+ - spec/internal/config/initializers/inflections.rb
247
+ - spec/internal/config/initializers/mime_types.rb
248
+ - spec/internal/config/initializers/secret_token.rb
249
+ - spec/internal/config/initializers/session_store.rb
250
+ - spec/internal/config/initializers/wrap_parameters.rb
251
+ - spec/internal/config/locales/en.yml
181
252
  - spec/internal/config/routes.rb
182
- - spec/internal/config/solr.yml
183
- - spec/internal/db/combustion_test.sqlite
253
+ - spec/internal/config.ru
254
+ - spec/internal/db/development.sqlite3
184
255
  - spec/internal/db/schema.rb
256
+ - spec/internal/db/seeds.rb
257
+ - spec/internal/db/test.sqlite3
258
+ - spec/internal/Gemfile
259
+ - spec/internal/Gemfile.lock
260
+ - spec/internal/lib/generators/test_app_generator.rb
261
+ - spec/internal/log/development.log
262
+ - spec/internal/log/test.log
263
+ - spec/internal/public/404.html
264
+ - spec/internal/public/422.html
265
+ - spec/internal/public/500.html
185
266
  - spec/internal/public/favicon.ico
267
+ - spec/internal/public/robots.txt
268
+ - spec/internal/Rakefile
269
+ - spec/internal/README.rdoc
270
+ - spec/internal/test/test_helper.rb
186
271
  - spec/lib/blacklight_to_solr_spec.rb
187
272
  - spec/marc_data/chomsky.mrc
188
273
  - spec/marc_data/social_journal.mrc
189
274
  - spec/rcov.opts
190
275
  - spec/spec.opts
191
276
  - spec/spec_helper.rb
277
+ - spec/test_app_templates/Gemfile.extra
278
+ - spec/test_app_templates/lib/generators/test_app_generator.rb
192
279
  - spec/views/explain.xml.builder_spec.rb
193
280
  has_rdoc:
@@ -1,17 +0,0 @@
1
- require 'rsolr-ext'
2
-
3
- module BlacklightCql
4
- class ExplainController < ApplicationController
5
- layout false
6
-
7
- def index
8
- @luke_response = Blacklight.solr.luke
9
- @config = CatalogController.blacklight_config
10
-
11
- render "explain.xml.builder", :content_type => "application/xml"
12
- end
13
-
14
- end
15
-
16
-
17
- end