diff --git a/.travis.yml b/.travis.yml
index 4562278..3dc7768 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,21 +3,18 @@ notifications:
language: ruby
sudo: false
rvm:
- - 2.2.3
+ - 2.3.0
matrix:
include:
- - rvm: 2.2.2
- env: "RAILS_VERSION=4.1.13"
- - rvm: 2.1.6
- env: "RAILS_VERSION=4.2.4"
- allow_failures:
- - rvm: jruby
- env: "RAILS_VERSION=4.2.4 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
- - rvm: 1.9.3
+ - rvm: 2.2.4
+ env: "RAILS_VERSION=4.1.14"
+
+before_install:
+ - gem install bundler
env:
- - "RAILS_VERSION=4.2.4"
+ - "RAILS_VERSION=4.2.6"
notifications:
irc: "irc.freenode.org#blacklight"
diff --git a/README.md b/README.md
index 5e387f4..c929488 100644
--- a/README.md
+++ b/README.md
@@ -196,7 +196,8 @@ The table below indicates which versions of Blacklight Maps are compatible with
Blacklight Maps version | works with Blacklight version
----------------------- | ---------------------
->= 0.4.0 | >= 5.12.0 to < 6.*
+0.5.0 | >= 6.1.0
+0.4.0 | >= 5.12.0 to < 6.*
<= 0.3.3 | >= 5.1 to <= 5.11.2
## Contributing
diff --git a/app/assets/stylesheets/blacklight_maps/blacklight-maps.css.scss b/app/assets/stylesheets/blacklight_maps/blacklight-maps.scss
similarity index 100%
rename from app/assets/stylesheets/blacklight_maps/blacklight-maps.css.scss
rename to app/assets/stylesheets/blacklight_maps/blacklight-maps.scss
diff --git a/app/assets/stylesheets/blacklight_maps/default.css.scss b/app/assets/stylesheets/blacklight_maps/default.scss
similarity index 100%
rename from app/assets/stylesheets/blacklight_maps/default.css.scss
rename to app/assets/stylesheets/blacklight_maps/default.scss
diff --git a/app/helpers/blacklight/blacklight_maps_helper_behavior.rb b/app/helpers/blacklight/blacklight_maps_helper_behavior.rb
index 9bf146a..1891d8d 100644
--- a/app/helpers/blacklight/blacklight_maps_helper_behavior.rb
+++ b/app/helpers/blacklight/blacklight_maps_helper_behavior.rb
@@ -26,7 +26,7 @@ def placename_value(geojson_hash)
def link_to_bbox_search bbox_coordinates
coords_for_search = bbox_coordinates.map { |v| v.to_s }
link_to(t('blacklight.maps.interactions.bbox_search'),
- catalog_index_path(spatial_search_type: "bbox",
+ search_catalog_path(spatial_search_type: "bbox",
coordinates: "[#{coords_for_search[1]},#{coords_for_search[0]} TO #{coords_for_search[3]},#{coords_for_search[2]}]",
view: default_document_index_view_type))
end
@@ -36,11 +36,11 @@ def link_to_placename_field field_value, field, displayvalue = nil
if params[:f] && params[:f][field] && params[:f][field].include?(field_value)
new_params = params
else
- new_params = add_facet_params(field, field_value)
+ new_params = search_state.add_facet_params(field, field_value)
end
new_params[:view] = default_document_index_view_type
link_to(displayvalue.presence || field_value,
- catalog_index_path(new_params.except(:id, :spatial_search_type, :coordinates)))
+ search_catalog_path(new_params.except(:id, :spatial_search_type, :coordinates)))
end
# create a link to a spatial search for a set of point coordinates
@@ -49,7 +49,7 @@ def link_to_point_search point_coordinates
new_params[:spatial_search_type] = "point"
new_params[:coordinates] = "#{point_coordinates[1]},#{point_coordinates[0]}"
new_params[:view] = default_document_index_view_type
- link_to(t('blacklight.maps.interactions.point_search'), catalog_index_path(new_params))
+ link_to(t('blacklight.maps.interactions.point_search'), search_catalog_path(new_params))
end
# return the facet field containing geographic data
@@ -76,8 +76,8 @@ def render_placename_heading(geojson_hash)
end
# render the map for #index and #map views
- def render_index_map
- render :partial => 'catalog/index_map',
+ def render_index_mapview
+ render :partial => 'catalog/index_mapview',
:locals => {:geojson_features => serialize_geojson(map_facet_values)}
end
diff --git a/app/views/catalog/_document_maps.html.erb b/app/views/catalog/_document_maps.html.erb
index c585532..e12a366 100644
--- a/app/views/catalog/_document_maps.html.erb
+++ b/app/views/catalog/_document_maps.html.erb
@@ -1,4 +1,4 @@
<% # container for all documents in map view -%>
- <%= render_index_map %>
+ <%= render_index_mapview %>
diff --git a/app/views/catalog/_index_map.html.erb b/app/views/catalog/_index_mapview.html.erb
similarity index 87%
rename from app/views/catalog/_index_map.html.erb
rename to app/views/catalog/_index_mapview.html.erb
index ada5a87..e8481e4 100644
--- a/app/views/catalog/_index_map.html.erb
+++ b/app/views/catalog/_index_mapview.html.erb
@@ -1,6 +1,6 @@
<%= blacklight_map_tag('blacklight-index-map',
{data:{searchcontrol: true,
- catalogpath: catalog_index_path,
+ catalogpath: search_catalog_path,
placenamefield: blacklight_config.view.maps.placename_field,
clustercount:'hits',
searchresultsview: default_document_index_view_type
diff --git a/blacklight-maps.gemspec b/blacklight-maps.gemspec
index a34d54d..61a4257 100644
--- a/blacklight-maps.gemspec
+++ b/blacklight-maps.gemspec
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_dependency "rails"
- spec.add_dependency "blacklight", ">= 5.12.0"
+ spec.add_dependency "blacklight", ">= 6.1.0"
spec.add_dependency "bootstrap-sass", "~> 3.2"
spec.add_dependency "leaflet-rails"
spec.add_dependency "leaflet-markercluster-rails"
diff --git a/config/jetty.yml b/config/jetty.yml
index df09451..ff47417 100644
--- a/config/jetty.yml
+++ b/config/jetty.yml
@@ -3,5 +3,5 @@ development:
jetty_port: 8983
test:
startup_wait: 60
- jetty_port: <%= ENV['TEST_JETTY_PORT'] || 8888 %>
+ jetty_port: <%= ENV['TEST_JETTY_PORT'] || 8888 %>
<%= ENV['TEST_JETTY_PATH'] ? "jetty_home: " + ENV['TEST_JETTY_PATH'] : '' %>
\ No newline at end of file
diff --git a/lib/blacklight/maps.rb b/lib/blacklight/maps.rb
index 8566f5c..f9749ee 100644
--- a/lib/blacklight/maps.rb
+++ b/lib/blacklight/maps.rb
@@ -9,18 +9,5 @@ module Maps
require 'blacklight/maps/geometry'
require 'blacklight/maps/maps_search_builder'
- def self.inject!
- CatalogController.send(:include, BlacklightMaps::ControllerOverride)
- CatalogController.send(:include, BlacklightMaps::RenderConstraintsOverride)
- CatalogController.send(:helper, BlacklightMaps::RenderConstraintsOverride) unless
- CatalogController.helpers.is_a?(BlacklightMaps::RenderConstraintsOverride)
-
- # inject into SearchHistory and SavedSearches so spatial queries display properly
- SearchHistoryController.send(:helper, BlacklightMaps::RenderConstraintsOverride) unless
- SearchHistoryController.helpers.is_a?(BlacklightMaps::RenderConstraintsOverride)
- SavedSearchesController.send(:helper, BlacklightMaps::RenderConstraintsOverride) unless
- SavedSearchesController.helpers.is_a?(BlacklightMaps::RenderConstraintsOverride)
- end
-
end
end
diff --git a/lib/blacklight/maps/controller_override.rb b/lib/blacklight/maps/controller_override.rb
index 3795a5d..860b0f1 100644
--- a/lib/blacklight/maps/controller_override.rb
+++ b/lib/blacklight/maps/controller_override.rb
@@ -1,25 +1,14 @@
module BlacklightMaps
module ControllerOverride
extend ActiveSupport::Concern
- included do
-
- if self.respond_to? :search_params_logic
- search_params_logic << :add_spatial_search_to_solr
- end
-
- if self.blacklight_config.search_builder_class
- self.blacklight_config.search_builder_class.send(:include,
- BlacklightMaps::MapsSearchBuilder
- ) unless
- self.blacklight_config.search_builder_class.include?(
- BlacklightMaps::MapsSearchBuilder
- )
- end
+ included do
+ self.send(:include, BlacklightMaps::RenderConstraintsOverride)
+ self.send(:helper, BlacklightMaps::RenderConstraintsOverride)
end
def map
- (@response, @document_list) = search_results(params, search_params_logic)
+ (@response, @document_list) = search_results(params)
params[:view] = 'maps'
respond_to do |format|
format.html
diff --git a/lib/blacklight/maps/engine.rb b/lib/blacklight/maps/engine.rb
index 322c108..0f7d2f2 100644
--- a/lib/blacklight/maps/engine.rb
+++ b/lib/blacklight/maps/engine.rb
@@ -5,29 +5,28 @@
module Blacklight
module Maps
class Engine < Rails::Engine
+
# Set some default configurations
- Blacklight::Configuration.default_values[:view].maps.geojson_field = "geojson"
- Blacklight::Configuration.default_values[:view].maps.placename_property = "placename"
- Blacklight::Configuration.default_values[:view].maps.coordinates_field = "coordinates"
- Blacklight::Configuration.default_values[:view].maps.search_mode = "placename" # or 'coordinates'
- Blacklight::Configuration.default_values[:view].maps.spatial_query_dist = 0.5
- Blacklight::Configuration.default_values[:view].maps.placename_field = "placename_field"
- Blacklight::Configuration.default_values[:view].maps.coordinates_facet_field = "coordinates_facet_field"
- Blacklight::Configuration.default_values[:view].maps.facet_mode = "geojson" # or 'coordinates'
- Blacklight::Configuration.default_values[:view].maps.tileurl = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
- Blacklight::Configuration.default_values[:view].maps.mapattribution = 'Map data © OpenStreetMap contributors, CC-BY-SA'
- Blacklight::Configuration.default_values[:view].maps.maxzoom = 18
- Blacklight::Configuration.default_values[:view].maps.show_initial_zoom = 5
+ initializer 'blacklight-maps.default_config' do |app|
+ Blacklight::Configuration.default_values[:view].maps.geojson_field = "geojson"
+ Blacklight::Configuration.default_values[:view].maps.placename_property = "placename"
+ Blacklight::Configuration.default_values[:view].maps.coordinates_field = "coordinates"
+ Blacklight::Configuration.default_values[:view].maps.search_mode = "placename" # or 'coordinates'
+ Blacklight::Configuration.default_values[:view].maps.spatial_query_dist = 0.5
+ Blacklight::Configuration.default_values[:view].maps.placename_field = "placename_field"
+ Blacklight::Configuration.default_values[:view].maps.coordinates_facet_field = "coordinates_facet_field"
+ Blacklight::Configuration.default_values[:view].maps.facet_mode = "geojson" # or 'coordinates'
+ Blacklight::Configuration.default_values[:view].maps.tileurl = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
+ Blacklight::Configuration.default_values[:view].maps.mapattribution = 'Map data © OpenStreetMap contributors, CC-BY-SA'
+ Blacklight::Configuration.default_values[:view].maps.maxzoom = 18
+ Blacklight::Configuration.default_values[:view].maps.show_initial_zoom = 5
+ end
# Add our helpers
initializer 'blacklight-maps.helpers' do |app|
ActionView::Base.send :include, BlacklightMapsHelper
end
- config.to_prepare do
- Blacklight::Maps.inject!
- end
-
# This makes our rake tasks visible.
rake_tasks do
Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))) do
diff --git a/lib/blacklight/maps/maps_search_builder.rb b/lib/blacklight/maps/maps_search_builder.rb
index edc04ad..17fbbd7 100644
--- a/lib/blacklight/maps/maps_search_builder.rb
+++ b/lib/blacklight/maps/maps_search_builder.rb
@@ -1,5 +1,10 @@
module BlacklightMaps
- module MapsSearchBuilder
+ module MapsSearchBuilderBehavior
+ extend ActiveSupport::Concern
+
+ included do
+ self.default_processor_chain += [:add_spatial_search_to_solr]
+ end
# add spatial search params to solr
def add_spatial_search_to_solr(solr_parameters = {})
diff --git a/lib/blacklight/maps/render_constraints_override.rb b/lib/blacklight/maps/render_constraints_override.rb
index bf2ec47..69ea27a 100644
--- a/lib/blacklight/maps/render_constraints_override.rb
+++ b/lib/blacklight/maps/render_constraints_override.rb
@@ -40,15 +40,14 @@ def render_search_to_s_coord(params)
# Render the spatial query constraints
def render_spatial_query(localized_params = params)
# So simple don't need a view template, we can just do it here.
- scope = localized_params.delete(:route_set) || self
return ''.html_safe if localized_params[:coordinates].blank?
render_constraint_element(spatial_constraint_label(localized_params),
localized_params[:coordinates],
:classes => ['coordinates'],
- :remove => scope.url_for(localized_params.merge(:coordinates=>nil,
- :spatial_search_type=>nil,
- :action=>'index')))
+ :remove => remove_constraint_url(localized_params.merge(:coordinates=>nil,
+ :spatial_search_type=>nil,
+ :action=>'index')))
end
def spatial_constraint_label(params)
diff --git a/lib/generators/blacklight_maps/install_generator.rb b/lib/generators/blacklight_maps/install_generator.rb
index ffe2fd5..6797811 100644
--- a/lib/generators/blacklight_maps/install_generator.rb
+++ b/lib/generators/blacklight_maps/install_generator.rb
@@ -21,5 +21,41 @@ def assets
end
end
end
+
+ def inject_search_builder
+ inject_into_file 'app/models/search_builder.rb', after: /include Blacklight::Solr::SearchBuilderBehavior.*$/ do
+ "\n include BlacklightMaps::MapsSearchBuilderBehavior\n"
+ end
+ end
+
+ def install_catalog_controller_mixin
+ inject_into_file "app/controllers/catalog_controller.rb", after: /include Blacklight::Catalog.*$/ do
+ "\n include BlacklightMaps::ControllerOverride\n"
+ end
+ end
+
+ def install_search_history_controller
+ target_file = "app/controllers/search_history_controller.rb"
+ if File.exists?(target_file)
+ inject_into_file target_file, after: /include Blacklight::SearchHistory/ do
+ "\n helper BlacklightMaps::RenderConstraintsOverride\n"
+ end
+ else
+ copy_file "search_history_controller.rb", target_file
+ end
+ end
+
+ def install_saved_searches_controller
+ target_file = "app/controllers/saved_searches_controller.rb"
+ if File.exists?(target_file)
+ inject_into_file target_file, after: /include Blacklight::SavedSearches/ do
+ "\n helper BlacklightMaps::RenderConstraintsOverride\n"
+ end
+ else
+ copy_file "saved_searches_controller.rb", target_file
+ end
+ end
+
+
end
end
\ No newline at end of file
diff --git a/lib/generators/blacklight_maps/templates/saved_searches_controller.rb b/lib/generators/blacklight_maps/templates/saved_searches_controller.rb
new file mode 100644
index 0000000..91abc3e
--- /dev/null
+++ b/lib/generators/blacklight_maps/templates/saved_searches_controller.rb
@@ -0,0 +1,5 @@
+class SavedSearchesController < ApplicationController
+ include Blacklight::SavedSearches
+
+ helper BlacklightMaps::RenderConstraintsOverride
+end
\ No newline at end of file
diff --git a/lib/generators/blacklight_maps/templates/search_history_controller.rb b/lib/generators/blacklight_maps/templates/search_history_controller.rb
new file mode 100644
index 0000000..f4ddc81
--- /dev/null
+++ b/lib/generators/blacklight_maps/templates/search_history_controller.rb
@@ -0,0 +1,5 @@
+class SearchHistoryController < ApplicationController
+ include Blacklight::SearchHistory
+
+ helper BlacklightMaps::RenderConstraintsOverride
+end
\ No newline at end of file
diff --git a/lib/railties/blacklight_maps.rake b/lib/railties/blacklight_maps.rake
index af15cb6..613f6d5 100644
--- a/lib/railties/blacklight_maps.rake
+++ b/lib/railties/blacklight_maps.rake
@@ -6,8 +6,9 @@ namespace :blacklight_maps do
desc "Put sample data into solr"
task :seed => :environment do
docs = YAML::load(File.open(File.expand_path(File.join('..', '..', '..', 'spec', 'fixtures', 'sample_solr_documents.yml'), __FILE__)))
- Blacklight.solr.add docs
- Blacklight.solr.commit
+ conn = Blacklight.default_index.connection
+ conn.add docs
+ conn.commit
end
end
end
\ No newline at end of file
diff --git a/spec/features/initial_view_spec.rb b/spec/features/initial_view_spec.rb
index 66524a5..f40da57 100644
--- a/spec/features/initial_view_spec.rb
+++ b/spec/features/initial_view_spec.rb
@@ -9,13 +9,13 @@
end
end
scenario 'defaults to zoom area of markers' do
- visit catalog_index_path f: { format: ['Book'] }, view: 'maps'
+ visit search_catalog_path f: { format: ['Book'] }, view: 'maps'
expect(page).to have_css '.leaflet-marker-icon.marker-cluster', count: 8
end
scenario 'when provided sets map to its view' do
map_tag = ''.html_safe
expect_any_instance_of(Blacklight::BlacklightMapsHelperBehavior).to receive(:blacklight_map_tag).and_return(map_tag)
- visit catalog_index_path f: { format: ['Book'] }, view: 'maps'
+ visit search_catalog_path f: { format: ['Book'] }, view: 'maps'
expect(page).to_not have_css '.leaflet-marker-icon.marker-cluster'
end
end
diff --git a/spec/features/maps_spec.rb b/spec/features/maps_spec.rb
index 3011040..29705b4 100644
--- a/spec/features/maps_spec.rb
+++ b/spec/features/maps_spec.rb
@@ -16,7 +16,7 @@
config.add_facet_field 'geojson', :limit => -2, :label => 'GeoJSON', :show => false
config.add_facet_fields_to_solr_request!
end
- visit catalog_index_path :q => 'korea', :view => 'maps'
+ visit search_catalog_path :q => 'korea', :view => 'maps'
end
it "should display map elements" do
@@ -158,7 +158,7 @@
config.add_facet_fields_to_solr_request!
end
visit map_path
- #print page.html # debugging
+ # print page.html # debugging
end
it "should display map elements" do
diff --git a/spec/features/show_view_maplet_spec.rb b/spec/features/show_view_maplet_spec.rb
index ea9da07..9597873 100644
--- a/spec/features/show_view_maplet_spec.rb
+++ b/spec/features/show_view_maplet_spec.rb
@@ -13,7 +13,7 @@
describe "item with point feature" do
before :each do
- visit catalog_path("00314247")
+ visit solr_document_path("00314247")
end
it "should display the maplet" do
@@ -40,7 +40,7 @@
describe "item with point and bbox features" do
before :each do
- visit catalog_path("2008308175")
+ visit solr_document_path("2008308175")
end
it "should show the correct mapped item count" do
@@ -75,7 +75,7 @@
# set maxzoom so we can test whether initial zoom is correct
config.view.maps.maxzoom = 8
end
- visit catalog_path("2009373514")
+ visit solr_document_path("2009373514")
end
it "should display a bounding box" do
diff --git a/spec/helpers/blacklight_maps_helper_spec.rb b/spec/helpers/blacklight_maps_helper_spec.rb
index 834e93a..d496484 100644
--- a/spec/helpers/blacklight_maps_helper_spec.rb
+++ b/spec/helpers/blacklight_maps_helper_spec.rb
@@ -4,10 +4,11 @@
describe BlacklightMapsHelper do
let(:blacklight_config) { Blacklight::Configuration.new }
+ let(:search_state) { Blacklight::SearchState.new({}, blacklight_config) }
def create_response
raw_response = eval(mock_query_response)
- Blacklight::SolrResponse.new(raw_response, raw_response['params'])
+ Blacklight::Solr::Response.new(raw_response, raw_response['params'])
end
let(:r) { create_response }
@@ -20,6 +21,8 @@ def create_response
CatalogController.blacklight_config = Blacklight::Configuration.new
@request = ActionDispatch::TestRequest.new
@catalog = CatalogController.new
+ allow(helper).to receive_messages(blacklight_configuration_context: Blacklight::Configuration::Context.new(@catalog))
+ allow(helper).to receive(:search_state).and_return(search_state)
@catalog.request = @request
@catalog.action_name = "index"
helper.instance_variable_set(:@_controller, @catalog)
@@ -120,9 +123,9 @@ def create_response
@response = r
end
- it "should return an array of Blacklight::SolrResponse::Facets::FacetItem items" do
+ it "should return an array of Blacklight::Solr::Response::Facets::FacetItem items" do
expect(helper.map_facet_values.class).to eq(Array)
- expect(helper.map_facet_values.first.class).to eq(Blacklight::SolrResponse::Facets::FacetItem)
+ expect(helper.map_facet_values.first.class).to eq(Blacklight::Solr::Response::Facets::FacetItem)
expect(helper.map_facet_values.length).to eq(5)
end
@@ -136,14 +139,14 @@ def create_response
end
- describe "render_index_map" do
+ describe "render_index_mapview" do
before do
@response = r
end
- it "should render the 'catalog/index_map' partial" do
- expect(helper.render_index_map).to include("$('#blacklight-index-map').blacklight_leaflet_map")
+ it "should render the 'catalog/index_mapview' partial" do
+ expect(helper.render_index_mapview).to include("$('#blacklight-index-map').blacklight_leaflet_map")
end
end
diff --git a/spec/lib/blacklight/maps/maps_search_builder_spec.rb b/spec/lib/blacklight/maps/maps_search_builder_spec.rb
index 2e089ef..cba85a2 100644
--- a/spec/lib/blacklight/maps/maps_search_builder_spec.rb
+++ b/spec/lib/blacklight/maps/maps_search_builder_spec.rb
@@ -1,55 +1,46 @@
require 'spec_helper'
-describe BlacklightMaps::MapsSearchBuilder do
+describe BlacklightMaps::MapsSearchBuilderBehavior do
- class MapsSearchBuilderTestClass
- cattr_accessor :blacklight_config, :blacklight_params
+ let(:blacklight_config) { CatalogController.blacklight_config.deep_copy }
+ let(:user_params) { Hash.new }
+ let(:context) { CatalogController.new }
- include Blacklight::SearchHelper
- include BlacklightMaps::MapsSearchBuilder
+ before { allow(context).to receive(:blacklight_config).and_return(blacklight_config) }
- def initialize blacklight_config, blacklight_params
- self.blacklight_config = blacklight_config
- self.blacklight_params = blacklight_params
+ let(:search_builder_class) do
+ Class.new(Blacklight::SearchBuilder) do
+ include Blacklight::Solr::SearchBuilderBehavior
+ include BlacklightMaps::MapsSearchBuilderBehavior
end
-
end
- let(:blacklight_config) { Blacklight::Configuration.new }
- let(:blacklight_params) { Hash.new }
- let(:solr_parameters) { Blacklight::Solr::Request.new }
-
- describe "add_spatial_search_to_solr" do
+ let(:search_builder) { search_builder_class.new(context) }
- before { @obj = MapsSearchBuilderTestClass.new blacklight_config, blacklight_params }
+ describe 'add_spatial_search_to_solr' do
- describe "coordinate search" do
+ describe 'coordinate search' do
- before do
- @obj.blacklight_params[:coordinates] = "35.86166,104.195397"
- @obj.blacklight_params[:spatial_search_type] = "point"
- end
+ subject { search_builder.with({coordinates: '35.86166,104.195397', spatial_search_type: 'point'}) }
- it "should return a coordinate point spatial search if coordinates are given" do
- expect(@obj.add_spatial_search_to_solr(solr_parameters)[:fq].first).to include('geofilt')
- expect(@obj.add_spatial_search_to_solr(solr_parameters)[:pt]).to eq(@obj.blacklight_params[:coordinates])
+ it 'should return a coordinate point spatial search if coordinates are given' do
+ expect(subject[:fq].first).to include('geofilt')
+ expect(subject[:pt]).to eq('35.86166,104.195397')
end
end
- describe "bbox search" do
+ describe 'bbox search' do
- before do
- @obj.blacklight_params[:coordinates] = "[6.7535159,68.162386 TO 35.5044752,97.395555]"
- @obj.blacklight_params[:spatial_search_type] = "bbox"
- end
+ subject { search_builder.with({coordinates: '[6.7535159,68.162386 TO 35.5044752,97.395555]',
+ spatial_search_type: 'bbox'}) }
- it "should return a bbox spatial search if a bbox is given" do
- expect(@obj.add_spatial_search_to_solr(solr_parameters)[:fq].first).to include(blacklight_config.view.maps.coordinates_field)
+ it 'should return a bbox spatial search if a bbox is given' do
+ expect(subject[:fq].first).to include(blacklight_config.view.maps.coordinates_field)
end
end
end
-end
\ No newline at end of file
+end
diff --git a/spec/test_app_templates/lib/generators/test_app_generator.rb b/spec/test_app_templates/lib/generators/test_app_generator.rb
index 2207692..e8cc672 100644
--- a/spec/test_app_templates/lib/generators/test_app_generator.rb
+++ b/spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -1,6 +1,7 @@
require 'rails/generators'
class TestAppGenerator < Rails::Generators::Base
+ source_root "../../spec/test_app_templates"
def remove_index
remove_file "public/index.html"
@@ -20,4 +21,12 @@ def run_gallery_install
generate 'blacklight_maps:install'
end
+ def configure_test_assets
+ insert_into_file 'config/environments/test.rb', :after => 'Rails.application.configure do' do
+ %q{
+ config.assets.digest = false
+}
+ end
+ end
+
end