bento_search 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bento_search/version.rb +1 -1
- data/test/dummy/config/application.rb +0 -6
- data/test/dummy/config/environments/development.rb +0 -3
- data/test/dummy/config/environments/test.rb +2 -6
- data/test/dummy/config/initializers/secret_token.rb +1 -0
- data/test/dummy/log/test.log +22323 -0
- data/test/functional/bento_search/search_controller_test.rb +4 -4
- data/test/helper/bento_search_helper_test.rb +0 -3
- data/test/helper/bento_truncate_helper_test.rb +0 -2
- data/test/search_engines/ebsco_host_engine_test.rb +1 -1
- data/test/search_engines/eds_engine_test.rb +2 -2
- data/test/search_engines/google_books_engine_test.rb +1 -1
- data/test/search_engines/primo_engine_test.rb +1 -1
- data/test/search_engines/summon_engine_test.rb +15 -15
- data/test/search_engines/worldcat_sru_dc_engine_test.rb +5 -5
- data/test/test_helper.rb +15 -0
- data/test/unit/openurl_creator_test.rb +4 -4
- data/test/unit/ris_creator_test.rb +31 -31
- data/test/view/atom_results_test.rb +2 -2
- metadata +12 -6
@@ -42,7 +42,7 @@ module BentoSearch
|
|
42
42
|
assert_response :success
|
43
43
|
assert_not_nil assigns(:results)
|
44
44
|
|
45
|
-
assert_template "bento_search/search"
|
45
|
+
assert_template "bento_search/search/search"
|
46
46
|
|
47
47
|
# meta tag with count
|
48
48
|
assert_tag(:tag => "meta", :attributes => {"itemprop" => "total_items", "content" => /^\d+$/ })
|
@@ -57,7 +57,7 @@ module BentoSearch
|
|
57
57
|
# warning?
|
58
58
|
assert_response :success
|
59
59
|
|
60
|
-
assert_template "bento_search/search"
|
60
|
+
assert_template "bento_search/search/search"
|
61
61
|
assert_template "bento_search/_search_error"
|
62
62
|
|
63
63
|
assert_no_tag(:tag => "meta", :attributes => {"itemprop" => "total_items"})
|
@@ -75,7 +75,7 @@ module BentoSearch
|
|
75
75
|
assert_not_nil assigns(:partial_wrapper)
|
76
76
|
|
77
77
|
assert_template "bento_search/_wrap_with_count"
|
78
|
-
assert_template "bento_search/search"
|
78
|
+
assert_template "bento_search/search/search"
|
79
79
|
end
|
80
80
|
|
81
81
|
test "non-routable engine" do
|
@@ -126,7 +126,7 @@ module BentoSearch
|
|
126
126
|
|
127
127
|
begin
|
128
128
|
Rails.application.routes.draw do
|
129
|
-
|
129
|
+
get "/custom_search" => "bento_search/search_controller_test/custom_search#search"
|
130
130
|
end
|
131
131
|
@controller = CustomSearchController.new
|
132
132
|
|
@@ -58,8 +58,8 @@ class EdsEngineTest < ActiveSupport::TestCase
|
|
58
58
|
|
59
59
|
assert_equal "1", parts.first
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
assert_includes parts, "SourceType:Academic Journals"
|
62
|
+
assert_includes parts, "SourceType:Magazines"
|
63
63
|
end
|
64
64
|
|
65
65
|
def test_has_http_timeout_set
|
@@ -111,7 +111,7 @@ class GoogleBooksEngineTest < ActiveSupport::TestCase
|
|
111
111
|
|
112
112
|
url = @engine.send(:args_to_search_url, :query => "cancer", :sort => "relevance")
|
113
113
|
|
114
|
-
|
114
|
+
refute_match "&orderBy", url
|
115
115
|
end
|
116
116
|
|
117
117
|
def test_fielded_search
|
@@ -64,7 +64,7 @@ class PrimoEngineTest < ActiveSupport::TestCase
|
|
64
64
|
|
65
65
|
assert first.title.html_safe?, "title is HTML safe"
|
66
66
|
|
67
|
-
|
67
|
+
assert_includes first.title, '<b class="bento_search_highlight">'
|
68
68
|
|
69
69
|
assert_present first.snippets
|
70
70
|
|
@@ -114,9 +114,9 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
114
114
|
|
115
115
|
query_params = CGI.parse( URI.parse(uri).query )
|
116
116
|
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
assert_includes query_params["s.fvf"], "ContentType,Newspaper Article,true"
|
118
|
+
assert_includes query_params["s.fvf"], "ContentType,Book,true"
|
119
|
+
assert_includes query_params["s.role"], "authenticated"
|
120
120
|
|
121
121
|
end
|
122
122
|
|
@@ -129,7 +129,7 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
129
129
|
|
130
130
|
query_params = CGI.parse( URI.parse(uri).query )
|
131
131
|
|
132
|
-
|
132
|
+
assert_includes query_params['s.hl'], "false"
|
133
133
|
end
|
134
134
|
|
135
135
|
|
@@ -143,11 +143,11 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
143
143
|
query_params = CGI.parse( URI.parse(uri).query )
|
144
144
|
|
145
145
|
assert_equal 1, query_params["a"].try(:length)
|
146
|
-
|
146
|
+
assert_includes query_params["a"], "a"
|
147
147
|
|
148
148
|
assert_equal 2, query_params["b"].try(:length)
|
149
|
-
|
150
|
-
|
149
|
+
assert_includes query_params["b"], "b1"
|
150
|
+
assert_includes query_params["b"], "b2"
|
151
151
|
end
|
152
152
|
|
153
153
|
def test_construct_peer_reviewed_only
|
@@ -156,7 +156,7 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
156
156
|
query_params = CGI.parse( URI.parse(uri).query )
|
157
157
|
|
158
158
|
assert_kind_of Array, query_params["s.fvf"]
|
159
|
-
|
159
|
+
assert_includes query_params["s.fvf"], "IsPeerReviewed,true"
|
160
160
|
end
|
161
161
|
|
162
162
|
def test_construct_online_only
|
@@ -165,7 +165,7 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
165
165
|
query_params = CGI.parse( URI.parse(uri).query )
|
166
166
|
|
167
167
|
assert_kind_of Array, query_params["s.fvf"]
|
168
|
-
|
168
|
+
assert_includes query_params["s.fvf"], "IsFullText,true"
|
169
169
|
end
|
170
170
|
|
171
171
|
def test_construct_pubyear_range
|
@@ -173,7 +173,7 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
173
173
|
|
174
174
|
query_params = CGI.parse( URI.parse(uri).query )
|
175
175
|
|
176
|
-
|
176
|
+
assert_includes query_params["s.rf"], "PublicationDate,1990:2000"
|
177
177
|
end
|
178
178
|
|
179
179
|
def test_construct_pubyear_range_open_bottom
|
@@ -181,7 +181,7 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
181
181
|
|
182
182
|
query_params = CGI.parse( URI.parse(uri).query )
|
183
183
|
|
184
|
-
|
184
|
+
assert_includes query_params["s.rf"], "PublicationDate,*:2000"
|
185
185
|
end
|
186
186
|
|
187
187
|
def test_construct_pubyear_range_open_top
|
@@ -189,7 +189,7 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
189
189
|
|
190
190
|
query_params = CGI.parse( URI.parse(uri).query )
|
191
191
|
|
192
|
-
|
192
|
+
assert_includes query_params["s.rf"], "PublicationDate,1990:*"
|
193
193
|
end
|
194
194
|
|
195
195
|
|
@@ -231,8 +231,8 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
231
231
|
|
232
232
|
first = results.first
|
233
233
|
|
234
|
-
|
235
|
-
|
234
|
+
assert_includes first.title, '<b class="bento_search_highlight">'
|
235
|
+
assert_includes first.title, '</b>'
|
236
236
|
|
237
237
|
assert first.title.html_safe?, "title is HTML safe"
|
238
238
|
end
|
@@ -244,7 +244,7 @@ class SummonEngineTest < ActiveSupport::TestCase
|
|
244
244
|
|
245
245
|
assert_present results.first.snippets
|
246
246
|
|
247
|
-
|
247
|
+
assert_includes results.first.snippets.first, '<b class="bento_search_highlight">'
|
248
248
|
end
|
249
249
|
|
250
250
|
test_with_cassette("live #get(id)", :summon) do
|
@@ -61,21 +61,21 @@ class WorldcatSruDcEngineTest < ActiveSupport::TestCase
|
|
61
61
|
def test_construct_servicelevel
|
62
62
|
url = @engine.construct_query_url(:query => "cancer")
|
63
63
|
query_hash = CGI.parse(URI.parse(url).query)
|
64
|
-
|
64
|
+
assert_not_includes query_hash["servicelevel"], "full"
|
65
65
|
|
66
66
|
url = @engine.construct_query_url(:query => "cancer auth", :auth => true)
|
67
67
|
query_hash = CGI.parse(URI.parse(url).query)
|
68
|
-
|
68
|
+
assert_includes query_hash["servicelevel"], "full"
|
69
69
|
|
70
70
|
default_on = BentoSearch::WorldcatSruDcEngine.new(@config.merge(:auth => true))
|
71
71
|
|
72
72
|
url = default_on.construct_query_url(:query => "cancer")
|
73
73
|
query_hash = CGI.parse(URI.parse(url).query)
|
74
|
-
|
74
|
+
assert_includes query_hash["servicelevel"], "full"
|
75
75
|
|
76
76
|
url = default_on.construct_query_url(:query => "cancer", :auth => false)
|
77
77
|
query_hash = CGI.parse(URI.parse(url).query)
|
78
|
-
|
78
|
+
assert_not_includes query_hash["servicelevel"], "full"
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_construct_cql
|
@@ -90,7 +90,7 @@ class WorldcatSruDcEngineTest < ActiveSupport::TestCase
|
|
90
90
|
"srw.kw = \"alpha's\"",
|
91
91
|
"srw.kw = \"one two\"",
|
92
92
|
"srw.kw = \"thr\\\"ee\""].each do |clause|
|
93
|
-
|
93
|
+
assert_includes components, clause
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
data/test/test_helper.rb
CHANGED
@@ -49,4 +49,19 @@ if ! defined? VCR
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
# re-open to add
|
53
|
+
# some custom assertions, that used to be in mini-test, or that
|
54
|
+
# we wanted to add.
|
55
|
+
class ActiveSupport::TestCase
|
52
56
|
|
57
|
+
def assert_present(object, msg = nil)
|
58
|
+
msg ||= "expected #{object} to be #present?"
|
59
|
+
assert(object.present?, msg)
|
60
|
+
end
|
61
|
+
|
62
|
+
def assert_blank(object, msg = nil)
|
63
|
+
msg ||= "expected #{object} to be #blank?"
|
64
|
+
assert object.blank?, msg
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -39,7 +39,7 @@ class OpenurlCreatorTest < ActiveSupport::TestCase
|
|
39
39
|
assert_equal "100", r.metadata["epage"]
|
40
40
|
assert_equal "Journal of Fakes", r.metadata["jtitle"]
|
41
41
|
assert_equal "12345678", r.metadata["issn"]
|
42
|
-
|
42
|
+
assert_includes r.identifiers, "info:doi/XXXX"
|
43
43
|
|
44
44
|
assert_equal "John", r.metadata["aufirst"]
|
45
45
|
assert_equal "Smith", r.metadata["aulast"]
|
@@ -61,7 +61,7 @@ class OpenurlCreatorTest < ActiveSupport::TestCase
|
|
61
61
|
|
62
62
|
r = BentoSearch::OpenurlCreator.new(item).to_openurl.referent
|
63
63
|
|
64
|
-
|
64
|
+
assert_includes r.identifiers, "info:pmid/#{pmid}"
|
65
65
|
end
|
66
66
|
|
67
67
|
|
@@ -166,7 +166,7 @@ class OpenurlCreatorTest < ActiveSupport::TestCase
|
|
166
166
|
openurl = item.to_openurl
|
167
167
|
|
168
168
|
# The legal way:
|
169
|
-
|
169
|
+
assert_includes openurl.referent.identifiers, 'info:oclcnum/12345'
|
170
170
|
# Not actually legal but common practice:
|
171
171
|
assert_equal '12345',openurl.referent.metadata["oclcnum"]
|
172
172
|
end
|
@@ -200,7 +200,7 @@ class OpenurlCreatorTest < ActiveSupport::TestCase
|
|
200
200
|
|
201
201
|
kev = openurl.kev
|
202
202
|
|
203
|
-
|
203
|
+
assert_includes kev, "&rft_id=info%3Adoi%2F10.3305%2Fnh.2012.27.5.5997"
|
204
204
|
end
|
205
205
|
|
206
206
|
def test_openurl_disabled
|
@@ -97,62 +97,62 @@ class RISCreatorTest < ActiveSupport::TestCase
|
|
97
97
|
def test_article
|
98
98
|
lines = ris_parse RISCreator.new(@@article).export
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
100
|
+
assert_includes lines, ['TY', 'JOUR']
|
101
|
+
assert_includes lines, ['TI', @@article.title]
|
102
|
+
assert_includes lines, ['T2', @@article.source_title]
|
103
|
+
assert_includes lines, ['SN', @@article.issn]
|
104
|
+
assert_includes lines, ['VL', @@article.volume]
|
105
|
+
assert_includes lines, ['IS', @@article.issue]
|
106
|
+
assert_includes lines, ['SP', @@article.start_page]
|
107
|
+
assert_includes lines, ['EP', @@article.end_page]
|
108
|
+
assert_includes lines, ['DO', @@article.doi]
|
109
|
+
assert_includes lines, ['AB', @@article.abstract]
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
|
111
|
+
assert_includes lines, ['AU', "Smith, John Q."]
|
112
|
+
assert_includes lines, ['AU', "Lopez, Maria"]
|
113
|
+
assert_includes lines, ['AU', "Some Guy"]
|
114
114
|
end
|
115
115
|
|
116
116
|
def test_book
|
117
117
|
lines = ris_parse RISCreator.new(@@book).export
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
119
|
+
assert_includes lines, ['TY', 'BOOK']
|
120
|
+
assert_includes lines, ['TI', @@book.title]
|
121
|
+
assert_includes lines, ['PY', @@book.year]
|
122
|
+
assert_includes lines, ['PB', @@book.publisher]
|
123
|
+
assert_includes lines, ['SN', @@book.isbn]
|
124
124
|
|
125
|
-
|
125
|
+
assert_includes lines, ['AU', "Smith, John Q."]
|
126
126
|
end
|
127
127
|
|
128
128
|
def test_book_chapter
|
129
129
|
lines = ris_parse RISCreator.new(@@book_chapter).export
|
130
130
|
|
131
|
-
|
131
|
+
assert_includes lines, ['TY', 'CHAP']
|
132
132
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
assert_includes lines, ['TI', @@book_chapter.title]
|
134
|
+
assert_includes lines, ['T2', @@book_chapter.source_title]
|
135
|
+
assert_includes lines, ['PY', @@book_chapter.year]
|
136
|
+
assert_includes lines, ['PB', @@book_chapter.publisher]
|
137
|
+
assert_includes lines, ['SP', @@book_chapter.start_page]
|
138
138
|
end
|
139
139
|
|
140
140
|
def test_dissertation
|
141
141
|
lines = ris_parse RISCreator.new(@@dissertation).export
|
142
142
|
|
143
|
-
|
143
|
+
assert_includes lines, ['TY', 'THES']
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
145
|
+
assert_includes lines, ['TI', @@dissertation.title]
|
146
|
+
assert_includes lines, ['PB', @@dissertation.publisher]
|
147
|
+
assert_includes lines, ['PY', @@dissertation.year]
|
148
148
|
end
|
149
149
|
|
150
150
|
def test_article_with_full_date
|
151
151
|
lines = ris_parse RISCreator.new(@@article_with_full_date).export
|
152
152
|
|
153
|
-
|
153
|
+
assert_includes lines, ['TY', 'JOUR']
|
154
154
|
|
155
|
-
|
155
|
+
assert_includes lines, ['DA', '2011/09/01']
|
156
156
|
end
|
157
157
|
|
158
158
|
|
@@ -206,8 +206,8 @@ class AtomResultsTest < ActionView::TestCase
|
|
206
206
|
|
207
207
|
assert_node(with_unique_id, "atom:id") do |id|
|
208
208
|
# based off of engine_id and unique_id
|
209
|
-
|
210
|
-
|
209
|
+
assert_includes id.text, "some_engine"
|
210
|
+
assert_includes id.text, "a000%3A%2F01"
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bento_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-12 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
21
|
version: 3.2.3
|
22
|
+
- - <
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '5'
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
24
27
|
version_requirements: !ruby/object:Gem::Requirement
|
25
28
|
none: false
|
26
29
|
requirements:
|
27
|
-
- -
|
30
|
+
- - ! '>='
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: 3.2.3
|
33
|
+
- - <
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '5'
|
30
36
|
- !ruby/object:Gem::Dependency
|
31
37
|
name: confstruct
|
32
38
|
requirement: !ruby/object:Gem::Requirement
|
@@ -424,7 +430,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
424
430
|
version: '0'
|
425
431
|
segments:
|
426
432
|
- 0
|
427
|
-
hash:
|
433
|
+
hash: 1645003956500659211
|
428
434
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
429
435
|
none: false
|
430
436
|
requirements:
|
@@ -433,7 +439,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
433
439
|
version: '0'
|
434
440
|
segments:
|
435
441
|
- 0
|
436
|
-
hash:
|
442
|
+
hash: 1645003956500659211
|
437
443
|
requirements: []
|
438
444
|
rubyforge_project:
|
439
445
|
rubygems_version: 1.8.23
|