blacklight_advanced_search 5.1.1 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a33cedcfe2d2ab6b0d6e13b59590f437a677c28f
4
+ data.tar.gz: 31a0d2c735d319c12d3b68f9ec628488422ae7b6
5
+ SHA512:
6
+ metadata.gz: 63f77f4d587c6e992d989d1cd77fc29c06e1501dce50ef1dfadac14897d8a046634ed763e965020a99d4e612d23ab99b951e25cac8490bf739ccab996a6a9019
7
+ data.tar.gz: c150f0260b05357f3def4aa0dbfd1f96247fa9fcaef7cb55b76ba897b17553997f40b169b40f9c27520d01c25b219acb43935ac1bf3ad80eb1a77029aa8b9486
data/Gemfile CHANGED
@@ -2,33 +2,19 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rails', '~> 4.0'
6
-
7
- group :test do
8
- gem "bootstrap-sass"
9
- gem 'turbolinks'
10
- end
11
-
12
- gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
13
- gem 'sqlite3', platform: :ruby
14
-
15
- # These need to be listed here explicitly for engine_cart testing to work,
16
- # not really sure why the existing gemspec and Gemfile of test app aren't enough.
17
- gem 'jquery-rails'
18
- gem 'blacklight_marc'
19
-
20
- gem 'sass-rails'
21
- # If we don't specify 2.11.0 we'll end up with sprockets 2.12.0 in the main
22
- # Gemfile.lock but since sass-rails gets generated (rails new) into the test app
23
- # it'll want sprockets 2.11.0 and we'll have a conflict
24
- gem 'sprockets', '2.11.0'
25
-
26
- # If we don't specify 3.2.15 we'll end up with sass 3.3.2 in the main
27
- # Gemfile.lock but since sass-rails gets generated (rails new) into the test app
28
- # it'll want sass 3.2.0 and we'll have a conflict
29
- gem 'sass', '~> 3.2.0'
30
-
31
-
32
- if File.exists?('spec/test_app_templates/Gemfile.extra')
33
- eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra'
34
- end
5
+ file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
6
+ if File.exists?(file)
7
+ puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
8
+ instance_eval File.read(file)
9
+ else
10
+ gem 'rails', ENV['RAILS_VERSION']
11
+
12
+ # explicitly include sass-rails to get compatible sprocket dependencies
13
+ if ENV['RAILS_VERSION'] and ENV['RAILS_VERSION'] =~ /^4.2/
14
+ gem 'sass-rails', ">= 5.0.0.beta1"
15
+ gem 'responders', "~> 2.0"
16
+ else
17
+ gem 'sass-rails', "< 5.0"
18
+ gem 'coffee-rails', "~> 4.0.0"
19
+ end
20
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.1.1
1
+ 5.1.2
@@ -54,7 +54,12 @@ class BlacklightAdvancedSearch::AdvancedController < CatalogController
54
54
  # ensure empty query is all records, to fetch available facets on entire corpus
55
55
  input[:q] ||= '{!lucene}*:*'
56
56
 
57
- # first arg nil, use default search path.
58
- find(nil, input.to_hash)
57
+ # solr_repository was introduced in Blacklight 5.8
58
+ if respond_to? :solr_repository
59
+ solr_repository.search(input)
60
+ else
61
+ # first arg nil, use default search path.
62
+ find nil, input.to_hash
63
+ end
59
64
  end
60
65
  end
@@ -43,4 +43,9 @@ module AdvancedHelper
43
43
  end
44
44
  end
45
45
 
46
+ # Use configured facet partial name for facet or fallback on 'catalog/facet_limit'
47
+ def advanced_search_facet_partial_name(display_facet)
48
+ facet_configuration_for_field(display_facet.name).try(:partial) || "catalog/facet_limit"
49
+ end
50
+
46
51
  end
@@ -12,6 +12,5 @@
12
12
  <% end %>
13
13
  </ul>
14
14
  </div>
15
-
16
- <%= render_facet_limit display_facet, :layout => nil, :partial => 'catalog/facet_limit' %>
15
+ <%= render_facet_limit display_facet, :layout => nil, :partial => advanced_search_facet_partial_name(display_facet) %>
17
16
  </div>
@@ -22,11 +22,8 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_development_dependency "blacklight_marc"
24
24
  s.add_development_dependency "rails"
25
- s.add_development_dependency "rspec-rails"
25
+ s.add_development_dependency "rspec-rails", "~> 2.99"
26
+ s.add_development_dependency "capybara"
26
27
  s.add_development_dependency 'jettywrapper', ">= 1.4.2"
27
-
28
- # engine_cart 0.3 is out, but can't run tests if we're using it,
29
- # not sure what we need to change to work with 0.3, possibly cbeer
30
- # might know, in the meantime locking to 0.2.x.
31
- s.add_development_dependency 'engine_cart', "~> 0.2.2"
28
+ s.add_development_dependency 'engine_cart', "~> 0.4"
32
29
  end
@@ -11,6 +11,8 @@ require 'parsing_nesting/tree'
11
11
  # in your CatalogController
12
12
  module BlacklightAdvancedSearch::ParseBasicQ
13
13
  extend ActiveSupport::Concern
14
+
15
+ include Blacklight::SearchFields
14
16
 
15
17
  included do
16
18
  self.solr_search_params_logic += [:add_advanced_parse_q_to_solr]
@@ -11,35 +11,35 @@ describe "Blacklight Advanced Search Form" do
11
11
  end
12
12
 
13
13
  it "should have field and facet blocks" do
14
- page.should have_selector('.query-criteria')
15
- page.should have_selector('.limit-criteria')
14
+ expect(page).to have_selector('.query-criteria')
15
+ expect(page).to have_selector('.limit-criteria')
16
16
  end
17
17
 
18
18
  describe "query column" do
19
19
  it "should give the user a choice between and/or queries" do
20
- page.should have_selector('#op')
20
+ expect(page).to have_selector('#op')
21
21
  within('#op') do
22
- page.should have_selector('option[value="AND"]')
23
- page.should have_selector('option[value="OR"]')
22
+ expect(page).to have_selector('option[value="AND"]')
23
+ expect(page).to have_selector('option[value="OR"]')
24
24
  end
25
25
  end
26
26
 
27
27
  it "should list the configured search fields" do
28
- page.should have_selector '.advanced-search-field #title'
29
- page.should have_selector '.advanced-search-field #author'
28
+ expect(page).to have_selector '.advanced-search-field #title'
29
+ expect(page).to have_selector '.advanced-search-field #author'
30
30
  end
31
31
 
32
32
  it "should not list the search fields listed as not to be included in adv search" do
33
- page.should_not have_selector '.advanced_search_field #dummy_field'
33
+ expect(page).not_to have_selector '.advanced_search_field #dummy_field'
34
34
  end
35
35
  end
36
36
 
37
37
  describe "facet column" do
38
38
  it "should list facets" do
39
- page.should have_selector('.blacklight-language_facet')
39
+ expect(page).to have_selector('.blacklight-language_facet')
40
40
 
41
41
  within('.blacklight-language_facet') do
42
- page.should have_content "Language Facet"
42
+ expect(page).to have_content "Language Facet"
43
43
  end
44
44
  end
45
45
  end
@@ -47,14 +47,13 @@ describe "Blacklight Advanced Search Form" do
47
47
  it "scope searches to fields" do
48
48
  fill_in "title", :with => "Medicine"
49
49
  click_on "advanced-search-submit"
50
- puts page.current_url
51
- page.should have_content "Remove constraint Title: Medicine"
52
- page.should have_content "2007020969"
50
+ expect(page).to have_content "Remove constraint Title: Medicine"
51
+ expect(page).to have_content "2007020969"
53
52
  end
54
53
  end
55
54
 
56
55
  it "should show the search fields" do
57
56
  visit '/advanced'
58
- page.should have_selector('input#title')
57
+ expect(page).to have_selector('input#title')
59
58
  end
60
59
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe AdvancedHelper do
4
+ describe '#advanced_search_facet_partial_name' do
5
+ let(:field) { double(name: "field_name") }
6
+ it 'should return the configured partial name if present' do
7
+ expect(helper).to receive(:facet_configuration_for_field).with(field.name).and_return(double(partial: 'partial-name'))
8
+ expect(helper.advanced_search_facet_partial_name(field)).to eq "partial-name"
9
+ end
10
+ it 'should fallback on "catalog/facet_limit" in the absence of a configured partial' do
11
+ expect(helper).to receive(:facet_configuration_for_field).with(field.name).and_return(nil)
12
+ expect(helper.advanced_search_facet_partial_name(field)).to eq "catalog/facet_limit"
13
+ end
14
+ end
15
+ end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Blacklight Test Application' do
4
4
  it "should have a Blacklight module" do
5
- Blacklight.should be_a_kind_of(Module)
5
+ expect(Blacklight).to be_a_kind_of(Module)
6
6
  end
7
7
  it "should have a Catalog controller" do
8
- CatalogController.blacklight_config.should be_a_kind_of(Blacklight::Configuration)
8
+ expect(CatalogController.blacklight_config).to be_a_kind_of(Blacklight::Configuration)
9
9
  end
10
10
  end
@@ -18,9 +18,9 @@ describe "BlacklightAdvancedSearch::FilterParser" do
18
18
 
19
19
  fq_params = generate_solr_fq
20
20
 
21
- fq_params.find {|a| a =~ /format\:\((\"Book\"|\"Thesis\") +OR +(\"Thesis\"|\"Book\")/}.should_not be_nil
21
+ expect(fq_params.find {|a| a =~ /format\:\((\"Book\"|\"Thesis\") +OR +(\"Thesis\"|\"Book\")/}).not_to be_nil
22
22
 
23
- fq_params.find {|a| a =~ /location\:\((\"Library\"|\"Online\") +OR +(\"Library\"|\"Online\")/}.should_not be_nil
23
+ expect(fq_params.find {|a| a =~ /location\:\((\"Library\"|\"Online\") +OR +(\"Library\"|\"Online\")/}).not_to be_nil
24
24
 
25
25
 
26
26
  end
@@ -15,46 +15,46 @@ module ParseTreeSpecHelper
15
15
  # make sure they are and return the element
16
16
  def parse_one_element(s)
17
17
  l = parse(s)
18
- l.should be_kind_of( List )
19
- l.list.length.should == 1
18
+ expect(l).to be_kind_of( List )
19
+ expect(l.list.length).to eq(1)
20
20
  return l.list.first
21
21
  end
22
22
 
23
23
  def should_be_and_list(graph)
24
- graph.should be_kind_of( AndList )
24
+ expect(graph).to be_kind_of( AndList )
25
25
  yield graph.list if block_given?
26
26
  end
27
27
 
28
28
  def should_be_list(graph)
29
- graph.should be_kind_of( List)
29
+ expect(graph).to be_kind_of( List)
30
30
  yield graph.list if block_given?
31
31
  end
32
32
 
33
33
  def should_be_or_list(graph)
34
- graph.should be_kind_of( OrList )
34
+ expect(graph).to be_kind_of( OrList )
35
35
  yield graph.list if block_given?
36
36
  end
37
37
 
38
38
  def should_be_term(graph, value)
39
- graph.should be_kind_of( Term )
40
- graph.value.should == value
39
+ expect(graph).to be_kind_of( Term )
40
+ expect(graph.value).to eq(value)
41
41
  end
42
42
 
43
43
  def should_be_phrase(graph, value)
44
- graph.should be_kind_of( Phrase )
45
- graph.value.should == value
44
+ expect(graph).to be_kind_of( Phrase )
45
+ expect(graph.value).to eq(value)
46
46
  end
47
47
 
48
48
  def should_be_mandatory(graph)
49
- graph.should be_kind_of(MandatoryClause)
49
+ expect(graph).to be_kind_of(MandatoryClause)
50
50
  yield graph.operand if block_given?
51
51
  end
52
52
  def should_be_excluded(graph)
53
- graph.should be_kind_of(ExcludedClause)
53
+ expect(graph).to be_kind_of(ExcludedClause)
54
54
  yield graph.operand if block_given?
55
55
  end
56
56
  def should_be_not_expression(graph)
57
- graph.should be_kind_of(NotExpression)
57
+ expect(graph).to be_kind_of(NotExpression)
58
58
  yield graph.operand if block_given?
59
59
  end
60
60
  end
@@ -66,7 +66,7 @@ describe "NestingParser" do
66
66
 
67
67
  it "should build for term list" do
68
68
  should_be_list parse("one two three") do |list|
69
- list.length.should == 3
69
+ expect(list.length).to eq(3)
70
70
  should_be_term list[0], "one"
71
71
  should_be_term list[1], "two"
72
72
  should_be_term list[2], "three"
@@ -75,7 +75,7 @@ describe "NestingParser" do
75
75
 
76
76
  it "should build AND list" do
77
77
  should_be_and_list parse_one_element("one AND two AND three") do |list|
78
- list.length.should == 3
78
+ expect(list.length).to eq(3)
79
79
 
80
80
  should_be_term list[0], "one"
81
81
  should_be_term list[1], "two"
@@ -85,7 +85,7 @@ describe "NestingParser" do
85
85
 
86
86
  it "should build OR list" do
87
87
  should_be_or_list parse_one_element("one OR two OR three") do |list|
88
- list.length.should == 3
88
+ expect(list.length).to eq(3)
89
89
  should_be_term list[0], "one"
90
90
  should_be_term list[1], "two"
91
91
  should_be_term list[2], "three"
@@ -94,7 +94,7 @@ describe "NestingParser" do
94
94
 
95
95
  it "allows AND list of lists" do
96
96
  should_be_and_list parse_one_element('(one two) AND (blue yellow)') do |and_list|
97
- and_list.length.should == 2
97
+ expect(and_list.length).to eq(2)
98
98
  should_be_list and_list[0] do |list|
99
99
  should_be_term(list[0], "one")
100
100
  should_be_term(list[1], "two")
@@ -105,7 +105,7 @@ describe "NestingParser" do
105
105
 
106
106
  it "should build for mandatory and excluded" do
107
107
  should_be_list parse("+one -two") do |list|
108
- list.length.should == 2
108
+ expect(list.length).to eq(2)
109
109
 
110
110
  should_be_mandatory list[0] do |operand|
111
111
  should_be_term(operand, "one")
@@ -119,7 +119,7 @@ describe "NestingParser" do
119
119
 
120
120
  it "should build phrases" do
121
121
  should_be_list parse('"quick brown" +"jumps over" -"lazy dog"') do |list|
122
- list.length.should == 3
122
+ expect(list.length).to eq(3)
123
123
 
124
124
  should_be_phrase(list[0], "quick brown")
125
125
 
@@ -169,12 +169,12 @@ describe "NestingParser" do
169
169
 
170
170
  it "should bind OR more tightly than AND" do
171
171
  should_be_and_list parse_one_element("grey AND big OR small AND tail") do |list|
172
- list.length.should == 3
172
+ expect(list.length).to eq(3)
173
173
 
174
174
  should_be_term list[0], "grey"
175
175
 
176
176
  should_be_or_list list[1] do |or_list|
177
- or_list.length.should == 2
177
+ expect(or_list.length).to eq(2)
178
178
  should_be_term or_list[0], "big"
179
179
  should_be_term or_list[1], "small"
180
180
  end
@@ -185,17 +185,17 @@ describe "NestingParser" do
185
185
 
186
186
  it "should parse AND'd lists" do
187
187
  should_be_and_list parse_one_element("(foo bar one AND two) AND (three four ten OR twelve)") do |list|
188
- list.length.should == 2
188
+ expect(list.length).to eq(2)
189
189
 
190
190
  should_be_list(list[0]) do |first_half|
191
- first_half[0].value.should == 'foo'
192
- first_half[1].value.should == "bar"
191
+ expect(first_half[0].value).to eq('foo')
192
+ expect(first_half[1].value).to eq("bar")
193
193
  should_be_and_list(first_half[2])
194
194
  end
195
195
 
196
196
  should_be_list(list[1]) do |second_half|
197
- second_half[0].value.should == "three"
198
- second_half[1].value.should == "four"
197
+ expect(second_half[0].value).to eq("three")
198
+ expect(second_half[1].value).to eq("four")
199
199
  should_be_or_list second_half[2]
200
200
  end
201
201
  end
@@ -215,7 +215,7 @@ describe "NestingParser" do
215
215
  should_be_term or_list[1], "fun"
216
216
 
217
217
  should_be_and_list or_list[2] do |and_list|
218
- and_list.length.should == 2
218
+ expect(and_list.length).to eq(2)
219
219
 
220
220
  should_be_and_list and_list[0]
221
221
 
@@ -41,7 +41,7 @@ describe "NestingParser" do
41
41
  "(foo bar one AND two) AND (three four ten OR twelve)"
42
42
  ].each do |query|
43
43
  it "should consume<<#{query}>>" do
44
- lambda {@parser.parse(query)}.should_not raise_error
44
+ expect {@parser.parse(query)}.not_to raise_error
45
45
  end
46
46
  end
47
47
  end
@@ -18,19 +18,19 @@ module SolrQuerySpecHelper
18
18
 
19
19
  # yields localparam string, and the actual internal query
20
20
  def local_param_match(query)
21
- query.should =~ /^ *_query_:\"\{([^}]+)\}(.*)" *$/
21
+ expect(query).to match(/^ *_query_:\"\{([^}]+)\}(.*)" *$/)
22
22
  query =~ /^ *_query_:\"\{([^}]+)\}(.*)" *$/
23
- (param_str = $1).should_not be_nil
24
- (query = $2).should_not be_nil
23
+ expect(param_str = $1).not_to be_nil
24
+ expect(query = $2).not_to be_nil
25
25
 
26
26
  yield [param_str, query] if block_given?
27
27
  end
28
28
 
29
29
  def bare_local_param_match(query)
30
- query.should =~ / *\{([^}]+)\}(.*)/
30
+ expect(query).to match(/ *\{([^}]+)\}(.*)/)
31
31
  query =~ /\{([^}]+)\}(.*)/
32
- (param_str = $1).should_not be_nil
33
- (query = $2).should_not be_nil
32
+ expect(param_str = $1).not_to be_nil
33
+ expect(query = $2).not_to be_nil
34
34
  yield [param_str, query] if block_given?
35
35
  end
36
36
 
@@ -55,7 +55,7 @@ module SolrQuerySpecHelper
55
55
  regexp_str = regexp_str.gsub("(", '\(').gsub(')', '\)').gsub("$QUERY", nested_re).gsub("$ALL", "\\*\\:\\*")
56
56
  regexp = Regexp.new('^ *' + regexp_str + ' *$')
57
57
 
58
- top_query.should match( regexp )
58
+ expect(top_query).to match( regexp )
59
59
 
60
60
  yield *regexp.match(top_query).captures if block_given?
61
61
  end
@@ -71,14 +71,14 @@ describe "NestingParser" do
71
71
  end
72
72
  it "should include LocalParams" do
73
73
  local_param_match(@query) do |params, query|
74
- params.should include("pf=$pf_title")
75
- params.should include('qf=\'field field2^5\'')
74
+ expect(params).to include("pf=$pf_title")
75
+ expect(params).to include('qf=\'field field2^5\'')
76
76
  end
77
77
  end
78
78
 
79
79
  it "should include the query" do
80
80
  local_param_match(@query) do |params, query|
81
- query.should == "one two three"
81
+ expect(query).to eq("one two three")
82
82
  end
83
83
  end
84
84
  end
@@ -87,16 +87,16 @@ describe "NestingParser" do
87
87
  it "should insist on dismax for nested query" do
88
88
  query = parse("one two three").to_query(:defType => "field", :qf=>"$qf")
89
89
  local_param_match(query) do |params, query|
90
- params.should match(/^\!dismax /)
91
- params.should_not match(/field/)
90
+ expect(params).to match(/^\!dismax /)
91
+ expect(params).not_to match(/field/)
92
92
  end
93
93
  end
94
94
 
95
95
  it "should insist on edismax for nested query" do
96
96
  query = parse("one two three", 'edismax').to_query(:defType => "field", :qf=>"$qf")
97
97
  local_param_match(query) do |params, query|
98
- params.should match(/^\!edismax qf=\$qf/)
99
- params.should_not match(/field/)
98
+ expect(params).to match(/^\!edismax qf=\$qf/)
99
+ expect(params).not_to match(/field/)
100
100
  end
101
101
  end
102
102
  end
@@ -109,7 +109,7 @@ describe "NestingParser" do
109
109
  end
110
110
  it "should include query" do
111
111
  local_param_match(@full_query) do |params, query|
112
- query.should == @inner_query.gsub('"', '\\\\"')
112
+ expect(query).to eq(@inner_query.gsub('"', '\\\\"'))
113
113
  end
114
114
  end
115
115
  end
@@ -120,7 +120,7 @@ describe "NestingParser" do
120
120
  end
121
121
  it "should flatten to one dismax query" do
122
122
  local_param_match(@query) do |params, query|
123
- query.should == "one +two +three"
123
+ expect(query).to eq("one +two +three")
124
124
  end
125
125
  end
126
126
 
@@ -130,7 +130,7 @@ describe "NestingParser" do
130
130
  end
131
131
  it "should preserve +/- operators" do
132
132
  local_param_match(@query) do |params, query|
133
- query.should == "one -two +three"
133
+ expect(query).to eq("one -two +three")
134
134
  end
135
135
  end
136
136
  end
@@ -141,7 +141,7 @@ describe "NestingParser" do
141
141
  end
142
142
  it "should flatten into dismax" do
143
143
  local_param_match(@query) do |params, query|
144
- query.should == "blue +green -violet +big -small +medium"
144
+ expect(query).to eq("blue +green -violet +big -small +medium")
145
145
  end
146
146
  end
147
147
  end
@@ -149,8 +149,8 @@ describe "NestingParser" do
149
149
  it "for simple OR list, forcing mm=1" do
150
150
  query = parse("one OR two OR three").to_query(:qf => "$qf", :mm=>"50%")
151
151
  local_param_match(query) do |params, query|
152
- params.should include("mm=1")
153
- query.should == "one two three"
152
+ expect(params).to include("mm=1")
153
+ expect(query).to eq("one two three")
154
154
  end
155
155
  end
156
156
  end
@@ -165,13 +165,13 @@ describe "NestingParser" do
165
165
  query_template_matcher(query, "( *$QUERY +OR +$QUERY *)" ) do |first_half, second_half|
166
166
 
167
167
  local_param_match(first_half) do |params, query|
168
- params.should include("qf=$qf")
169
- query.should == "one two three"
168
+ expect(params).to include("qf=$qf")
169
+ expect(query).to eq("one two three")
170
170
  end
171
171
 
172
172
  local_param_match(second_half) do |params, query|
173
- params.should include("qf=$qf")
174
- query.should == "red -green +blue"
173
+ expect(params).to include("qf=$qf")
174
+ expect(query).to eq("red -green +blue")
175
175
  end
176
176
  end
177
177
  end
@@ -181,8 +181,8 @@ describe "NestingParser" do
181
181
  query = parse("a OR b AND x OR y").to_query( params )
182
182
 
183
183
  query_template_matcher(query, "( *$QUERY +AND +$QUERY *)" ) do |first, second|
184
- first.should == parse("a OR b").to_query(params)
185
- second.should == parse("x OR y").to_query(params)
184
+ expect(first).to eq(parse("a OR b").to_query(params))
185
+ expect(second).to eq(parse("x OR y").to_query(params))
186
186
  end
187
187
  end
188
188
 
@@ -191,8 +191,8 @@ describe "NestingParser" do
191
191
  query = parse("(one +two three) AND (four five -six)").to_query( params )
192
192
 
193
193
  query_template_matcher(query, "( *$QUERY +AND +$QUERY *)" ) do |first, second|
194
- first.should == parse("one +two three").to_query(params)
195
- second.should == parse("four five -six").to_query(params)
194
+ expect(first).to eq(parse("one +two three").to_query(params))
195
+ expect(second).to eq(parse("four five -six").to_query(params))
196
196
  end
197
197
 
198
198
  end
@@ -202,18 +202,18 @@ describe "NestingParser" do
202
202
 
203
203
  query_template_matcher(query, "( *$QUERY +AND +( *$QUERY +OR +($ALL AND NOT $QUERY *) *) +AND NOT $QUERY *)") do |red_q, dawn_q, night_q, moscow_q|
204
204
 
205
- local_param_match(red_q) { |params, query| query.should == "red" }
205
+ local_param_match(red_q) { |params, query| expect(query).to eq("red") }
206
206
 
207
- local_param_match(dawn_q) { |params, query| query.should == "dawn"}
207
+ local_param_match(dawn_q) { |params, query| expect(query).to eq("dawn")}
208
208
 
209
209
  local_param_match(night_q) do |params, query|
210
- params.should include("mm=1")
211
- query.should == "night afternoon"
210
+ expect(params).to include("mm=1")
211
+ expect(query).to eq("night afternoon")
212
212
  end
213
213
 
214
214
  local_param_match(moscow_q) do |params, query|
215
- params.should include("mm=1")
216
- query.should == "moscow beach"
215
+ expect(params).to include("mm=1")
216
+ expect(query).to eq("moscow beach")
217
217
  end
218
218
 
219
219
  end
@@ -228,7 +228,7 @@ describe "NestingParser" do
228
228
  query = parse("NOT frog").to_query
229
229
 
230
230
  query_template_matcher(query, "NOT $QUERY") do |q|
231
- q.should == parse("frog").to_query
231
+ expect(q).to eq(parse("frog").to_query)
232
232
  end
233
233
  end
234
234
  it "binds tightly" do
@@ -237,11 +237,11 @@ describe "NestingParser" do
237
237
  query_template_matcher(query, "$QUERY AND NOT $QUERY") do |q1, q2|
238
238
 
239
239
  local_param_match(q1) do |params, query|
240
- query.should == "one three"
240
+ expect(query).to eq("one three")
241
241
  end
242
242
 
243
243
  local_param_match(q2) do |params, query|
244
- query.should == "two"
244
+ expect(query).to eq("two")
245
245
  end
246
246
  end
247
247
 
@@ -250,9 +250,9 @@ describe "NestingParser" do
250
250
  query = parse("one OR two NOT (three OR four AND five)").to_query
251
251
  #"_query_:'{!dismax mm=1}one two' AND NOT ( _query_:'{!dismax mm=1}three four' AND _query_:'{!dismax }five' )"
252
252
  query_template_matcher(query, "$QUERY +AND NOT +( *$QUERY +AND +$QUERY *)") do |external_or, internal_or, internal_term|
253
- external_or.should == parse("one OR two").to_query
254
- internal_or.should == parse("three OR four").to_query
255
- internal_term.should == parse("five").to_query
253
+ expect(external_or).to eq(parse("one OR two").to_query)
254
+ expect(internal_or).to eq(parse("three OR four").to_query)
255
+ expect(internal_term).to eq(parse("five").to_query)
256
256
  end
257
257
  end
258
258
 
@@ -269,8 +269,8 @@ describe "NestingParser" do
269
269
 
270
270
  query_template_matcher(query, " *NOT $QUERY") do |query|
271
271
  local_param_match(query) do |params, query|
272
- params.should include("mm=1")
273
- query.should == 'one two \\"a phrase\\"'
272
+ expect(params).to include("mm=1")
273
+ expect(query).to eq('one two \\"a phrase\\"')
274
274
  end
275
275
  end
276
276
 
@@ -281,8 +281,8 @@ describe "NestingParser" do
281
281
 
282
282
  query_template_matcher(query, "NOT $QUERY") do |query|
283
283
  local_param_match(query) do |params, query|
284
- params.should =~ /mm=1 |$/
285
- query.should == 'one two three'
284
+ expect(params).to match(/mm=1 |$/)
285
+ expect(query).to eq('one two three')
286
286
  end
287
287
  end
288
288
  end
@@ -292,8 +292,8 @@ describe "NestingParser" do
292
292
 
293
293
  query_template_matcher(query, "NOT $QUERY") do |query|
294
294
  local_param_match(query) do |params, query|
295
- params.should include("mm=100%")
296
- query.should == "one two three"
295
+ expect(params).to include("mm=100%")
296
+ expect(query).to eq("one two three")
297
297
  end
298
298
  end
299
299
 
@@ -316,28 +316,28 @@ describe "NestingParser" do
316
316
  describe "simple search" do
317
317
  it "should work with local params" do
318
318
  hash = parse("one +two -three").to_single_query_params(@solr_local_params)
319
- hash[:defType].should == "dismax"
319
+ expect(hash[:defType]).to eq("dismax")
320
320
  bare_local_param_match(hash[:q]) do |params, query|
321
- query.should == "one +two -three"
322
- params.should include("pf=$title_pf")
323
- params.should include("qf=$title_qf")
321
+ expect(query).to eq("one +two -three")
322
+ expect(params).to include("pf=$title_pf")
323
+ expect(params).to include("qf=$title_qf")
324
324
  end
325
325
  end
326
326
 
327
327
  it "should work without local params" do
328
328
  hash = parse("one +two -three").to_single_query_params({})
329
- hash[:defType].should == "dismax"
330
- hash[:q].should == "one +two -three"
329
+ expect(hash[:defType]).to eq("dismax")
330
+ expect(hash[:q]).to eq("one +two -three")
331
331
  end
332
332
  end
333
333
  describe "simple pure negative" do
334
334
  it "should be nested NOT" do
335
335
  hash = parse("-one -two").to_single_query_params({})
336
- hash[:defType].should == "dismax"
336
+ expect(hash[:defType]).to eq("dismax")
337
337
  query_template_matcher(hash[:q], "NOT $QUERY") do |query|
338
338
  local_param_match(query) do |params, query|
339
- query.should == "one two"
340
- params.should include("mm=1")
339
+ expect(query).to eq("one two")
340
+ expect(params).to include("mm=1")
341
341
  end
342
342
  end
343
343
  end
@@ -345,16 +345,16 @@ describe "NestingParser" do
345
345
  describe "complex query" do
346
346
  it "should parse" do
347
347
  hash = parse("one AND (two OR three)").to_single_query_params({})
348
- hash[:defType].should == "lucene"
348
+ expect(hash[:defType]).to eq("lucene")
349
349
  query_template_matcher(hash[:q], "( *$QUERY +AND +$QUERY *)") do |first, second|
350
350
  local_param_match(first) do |params, query|
351
- params.should include("dismax")
352
- query.should == "one"
351
+ expect(params).to include("dismax")
352
+ expect(query).to eq("one")
353
353
  end
354
354
  local_param_match(second) do |params, query|
355
- params.should include("mm=1")
356
- params.should include("dismax")
357
- query.should == "two three"
355
+ expect(params).to include("mm=1")
356
+ expect(params).to include("dismax")
357
+ expect(query).to eq("two three")
358
358
  end
359
359
  end
360
360
  end
@@ -3,10 +3,6 @@ require 'rails/generators'
3
3
  class TestAppGenerator < Rails::Generators::Base
4
4
  source_root File.expand_path("../../../../test_app_templates", __FILE__)
5
5
 
6
- def copy_blacklight_test_app_rake_task
7
- copy_file "lib/tasks/blacklight_test_app.rake"
8
- end
9
-
10
6
  def remove_index
11
7
  remove_file "public/index.html"
12
8
  remove_file 'app/assets/images/rails.png'
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_advanced_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
5
- prerelease:
4
+ version: 5.1.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jonathan Rochkind
@@ -10,126 +9,126 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-08-21 00:00:00.000000000 Z
12
+ date: 2014-12-17 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: blacklight
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: '5.2'
23
- - - <
21
+ - - "<"
24
22
  - !ruby/object:Gem::Version
25
23
  version: '6.0'
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
- - - ! '>='
28
+ - - ">="
32
29
  - !ruby/object:Gem::Version
33
30
  version: '5.2'
34
- - - <
31
+ - - "<"
35
32
  - !ruby/object:Gem::Version
36
33
  version: '6.0'
37
34
  - !ruby/object:Gem::Dependency
38
35
  name: parslet
39
36
  requirement: !ruby/object:Gem::Requirement
40
- none: false
41
37
  requirements:
42
- - - ! '>='
38
+ - - ">="
43
39
  - !ruby/object:Gem::Version
44
40
  version: '0'
45
41
  type: :runtime
46
42
  prerelease: false
47
43
  version_requirements: !ruby/object:Gem::Requirement
48
- none: false
49
44
  requirements:
50
- - - ! '>='
45
+ - - ">="
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0'
53
48
  - !ruby/object:Gem::Dependency
54
49
  name: blacklight_marc
55
50
  requirement: !ruby/object:Gem::Requirement
56
- none: false
57
51
  requirements:
58
- - - ! '>='
52
+ - - ">="
59
53
  - !ruby/object:Gem::Version
60
54
  version: '0'
61
55
  type: :development
62
56
  prerelease: false
63
57
  version_requirements: !ruby/object:Gem::Requirement
64
- none: false
65
58
  requirements:
66
- - - ! '>='
59
+ - - ">="
67
60
  - !ruby/object:Gem::Version
68
61
  version: '0'
69
62
  - !ruby/object:Gem::Dependency
70
63
  name: rails
71
64
  requirement: !ruby/object:Gem::Requirement
72
- none: false
73
65
  requirements:
74
- - - ! '>='
66
+ - - ">="
75
67
  - !ruby/object:Gem::Version
76
68
  version: '0'
77
69
  type: :development
78
70
  prerelease: false
79
71
  version_requirements: !ruby/object:Gem::Requirement
80
- none: false
81
72
  requirements:
82
- - - ! '>='
73
+ - - ">="
83
74
  - !ruby/object:Gem::Version
84
75
  version: '0'
85
76
  - !ruby/object:Gem::Dependency
86
77
  name: rspec-rails
87
78
  requirement: !ruby/object:Gem::Requirement
88
- none: false
89
79
  requirements:
90
- - - ! '>='
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.99'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.99'
90
+ - !ruby/object:Gem::Dependency
91
+ name: capybara
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
91
95
  - !ruby/object:Gem::Version
92
96
  version: '0'
93
97
  type: :development
94
98
  prerelease: false
95
99
  version_requirements: !ruby/object:Gem::Requirement
96
- none: false
97
100
  requirements:
98
- - - ! '>='
101
+ - - ">="
99
102
  - !ruby/object:Gem::Version
100
103
  version: '0'
101
104
  - !ruby/object:Gem::Dependency
102
105
  name: jettywrapper
103
106
  requirement: !ruby/object:Gem::Requirement
104
- none: false
105
107
  requirements:
106
- - - ! '>='
108
+ - - ">="
107
109
  - !ruby/object:Gem::Version
108
110
  version: 1.4.2
109
111
  type: :development
110
112
  prerelease: false
111
113
  version_requirements: !ruby/object:Gem::Requirement
112
- none: false
113
114
  requirements:
114
- - - ! '>='
115
+ - - ">="
115
116
  - !ruby/object:Gem::Version
116
117
  version: 1.4.2
117
118
  - !ruby/object:Gem::Dependency
118
119
  name: engine_cart
119
120
  requirement: !ruby/object:Gem::Requirement
120
- none: false
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.2.2
124
+ version: '0.4'
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
- none: false
129
128
  requirements:
130
- - - ~>
129
+ - - "~>"
131
130
  - !ruby/object:Gem::Version
132
- version: 0.2.2
131
+ version: '0.4'
133
132
  description:
134
133
  email:
135
134
  - blacklight-development@googlegroups.com
@@ -137,8 +136,8 @@ executables: []
137
136
  extensions: []
138
137
  extra_rdoc_files: []
139
138
  files:
140
- - .gitignore
141
- - .travis.yml
139
+ - ".gitignore"
140
+ - ".travis.yml"
142
141
  - Gemfile
143
142
  - LICENSE
144
143
  - README.md
@@ -182,6 +181,7 @@ files:
182
181
  - lib/parsing_nesting/grammar.rb
183
182
  - lib/parsing_nesting/tree.rb
184
183
  - spec/features/blacklight_advanced_search_form_spec.rb
184
+ - spec/helpers/advanced_helper_spec.rb
185
185
  - spec/integration/blacklight_stub_spec.rb
186
186
  - spec/lib/deep_merge_spec.rb
187
187
  - spec/lib/filter_parser_spec.rb
@@ -192,42 +192,34 @@ files:
192
192
  - spec/rcov.opts
193
193
  - spec/spec.opts
194
194
  - spec/spec_helper.rb
195
- - spec/test_app_templates/Gemfile.extra
196
195
  - spec/test_app_templates/app/controllers/catalog_controller.rb
197
196
  - spec/test_app_templates/lib/generators/test_app_generator.rb
198
- - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
199
197
  homepage: http://projectblacklight.org/
200
198
  licenses: []
199
+ metadata: {}
201
200
  post_install_message:
202
201
  rdoc_options: []
203
202
  require_paths:
204
203
  - lib
205
204
  required_ruby_version: !ruby/object:Gem::Requirement
206
- none: false
207
205
  requirements:
208
- - - ! '>='
206
+ - - ">="
209
207
  - !ruby/object:Gem::Version
210
208
  version: '0'
211
- segments:
212
- - 0
213
- hash: 378368463660479159
214
209
  required_rubygems_version: !ruby/object:Gem::Requirement
215
- none: false
216
210
  requirements:
217
- - - ! '>='
211
+ - - ">="
218
212
  - !ruby/object:Gem::Version
219
213
  version: '0'
220
- segments:
221
- - 0
222
- hash: 378368463660479159
223
214
  requirements: []
224
215
  rubyforge_project: blacklight
225
- rubygems_version: 1.8.23
216
+ rubygems_version: 2.2.2
226
217
  signing_key:
227
- specification_version: 3
218
+ specification_version: 4
228
219
  summary: Blacklight Advanced Search plugin
229
220
  test_files:
230
221
  - spec/features/blacklight_advanced_search_form_spec.rb
222
+ - spec/helpers/advanced_helper_spec.rb
231
223
  - spec/integration/blacklight_stub_spec.rb
232
224
  - spec/lib/deep_merge_spec.rb
233
225
  - spec/lib/filter_parser_spec.rb
@@ -238,7 +230,5 @@ test_files:
238
230
  - spec/rcov.opts
239
231
  - spec/spec.opts
240
232
  - spec/spec_helper.rb
241
- - spec/test_app_templates/Gemfile.extra
242
233
  - spec/test_app_templates/app/controllers/catalog_controller.rb
243
234
  - spec/test_app_templates/lib/generators/test_app_generator.rb
244
- - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
@@ -1,16 +0,0 @@
1
- platforms :jruby do
2
- gem 'mediashelf-loggable', '>= 0.4.8'
3
- gem 'therubyrhino'
4
- end
5
-
6
- gem 'blacklight', github: 'projectblacklight/blacklight', branch: 'master'
7
-
8
- group :test do
9
- gem 'rspec-rails', '~> 2.13'
10
- gem 'generator_spec'
11
- gem 'capybara'
12
- gem 'simplecov', :platform => :mri_19
13
- end
14
-
15
- gem 'jettywrapper', '>= 1.2.0'
16
-
@@ -1,14 +0,0 @@
1
- require 'rspec/core/rake_task'
2
-
3
- desc "run the blacklight gem spec"
4
- gem_home = File.expand_path('../../../../..', __FILE__)
5
-
6
- namespace :blacklight_test_app do
7
-
8
- RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.pattern = gem_home + '/spec/**/*_spec.rb'
10
- t.rspec_opts = "--colour"
11
- t.ruby_opts = "-I#{gem_home}/spec"
12
- end
13
-
14
- end