rspec-solr 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Gemfile +1 -1
- data/README.md +2 -1
- data/lib/rspec-solr/include_documents_matcher.rb +9 -9
- data/lib/rspec-solr/version.rb +1 -1
- data/rspec-solr.gemspec +1 -1
- data/spec/include_document_spec.rb +21 -21
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 159dddc6ad7d9c526ed35cd8f9dc3d866c9f31d4
|
|
4
|
+
data.tar.gz: ffe5545829ef3e64004c8508de010feaae498bdc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e98609baedef42070de878eb3e3561db547b6ada91c6302be82c7702da742aeec88fe64e7fb673cb8e23785de72eb16f4410ed6a0d82fe977a9efaaad325d59
|
|
7
|
+
data.tar.gz: 7589db2b999847a7c888516b47da960e0c8433abf0ee63b8d52d4b7b2b51f7cf5344150b6a4709307bc8ec193022eef43fad575f05079563d78f5f3265bb36f1
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
[](https://travis-ci.org/sul-dlss/rspec-solr)
|
|
2
2
|
[](https://coveralls.io/r/sul-dlss/rspec-solr)
|
|
3
|
-
[](https://gemnasium.com/sul-dlss/rspec-solr)
|
|
4
3
|
|
|
5
4
|
# RSpec Solr
|
|
6
5
|
|
|
@@ -154,6 +153,8 @@ Please share yours!
|
|
|
154
153
|
5. Create new Pull Request
|
|
155
154
|
|
|
156
155
|
## Releases
|
|
156
|
+
- <b>3.0.0</b> Add compatibility with rspec ~> 3.5
|
|
157
|
+
- <b>2.0.0</b> No release notes
|
|
157
158
|
- <b>1.0.1</b> fix spec failing in travis due to diff error message in later rspec version
|
|
158
159
|
- <b>1.0.0</b> declare victory and make 0.2.0 into 1.0.0
|
|
159
160
|
- <b>0.2.0</b> add facet support have_facet_field(fld_name).with_value(fld_value)
|
|
@@ -33,15 +33,15 @@ module RSpec
|
|
|
33
33
|
|
|
34
34
|
# override failure message for improved readability
|
|
35
35
|
def failure_message
|
|
36
|
-
assert_ivars :@actual, :@
|
|
36
|
+
assert_ivars :@actual, :@expecteds
|
|
37
37
|
name_to_sentence = 'include'
|
|
38
38
|
# FIXME: DRY up these messages across cases and across should and should_not
|
|
39
39
|
if @before_expected
|
|
40
|
-
"expected response to #{name_to_sentence} #{doc_label_str(@
|
|
40
|
+
"expected response to #{name_to_sentence} #{doc_label_str(@expecteds)}#{to_sentence(@expecteds)} before #{doc_label_str(@before_expected)} matching #{@before_expected.inspect}: #{@actual.inspect} "
|
|
41
41
|
elsif @min_for_last_matching_doc_pos
|
|
42
|
-
"expected each of the first #{@min_for_last_matching_doc_pos} documents to #{name_to_sentence}#{to_sentence(@
|
|
42
|
+
"expected each of the first #{@min_for_last_matching_doc_pos} documents to #{name_to_sentence}#{to_sentence(@expecteds)} in response: #{@actual.inspect}"
|
|
43
43
|
elsif @max_doc_position
|
|
44
|
-
"expected response to #{name_to_sentence} #{doc_label_str(@
|
|
44
|
+
"expected response to #{name_to_sentence} #{doc_label_str(@expecteds)}#{to_sentence(@expecteds)} in first #{@max_doc_position} results: #{@actual.inspect}"
|
|
45
45
|
else
|
|
46
46
|
super
|
|
47
47
|
end
|
|
@@ -49,14 +49,14 @@ module RSpec
|
|
|
49
49
|
|
|
50
50
|
# override failure message for improved readability
|
|
51
51
|
def failure_message_when_negated
|
|
52
|
-
assert_ivars :@actual, :@
|
|
52
|
+
assert_ivars :@actual, :@expecteds
|
|
53
53
|
name_to_sentence = 'include'
|
|
54
54
|
if @before_expected
|
|
55
|
-
"expected response not to #{name_to_sentence} #{doc_label_str(@
|
|
55
|
+
"expected response not to #{name_to_sentence} #{doc_label_str(@expecteds)}#{to_sentence(@expecteds)} before #{doc_label_str(@before_expected)} matching #{@before_expected.inspect}: #{@actual.inspect} "
|
|
56
56
|
elsif @min_for_last_matching_doc_pos
|
|
57
|
-
"expected some of the first #{@min_for_last_matching_doc_pos} documents not to #{name_to_sentence}#{to_sentence(@
|
|
57
|
+
"expected some of the first #{@min_for_last_matching_doc_pos} documents not to #{name_to_sentence}#{to_sentence(@expecteds)} in response: #{@actual.inspect}"
|
|
58
58
|
elsif @max_doc_position
|
|
59
|
-
"expected response not to #{name_to_sentence} #{doc_label_str(@
|
|
59
|
+
"expected response not to #{name_to_sentence} #{doc_label_str(@expecteds)}#{to_sentence(@expecteds)} in first #{@max_doc_position} results: #{@actual.inspect}"
|
|
60
60
|
else
|
|
61
61
|
super
|
|
62
62
|
end
|
|
@@ -70,7 +70,7 @@ module RSpec
|
|
|
70
70
|
def excluded_from_actual
|
|
71
71
|
return [] unless @actual.respond_to?(:include?)
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
expecteds.each_with_object([]) do |expected_item, memo|
|
|
74
74
|
if comparing_doc_to_solr_resp_hash?(expected_item)
|
|
75
75
|
if @before_expected
|
|
76
76
|
before_ix = actual.get_first_doc_index(@before_expected)
|
data/lib/rspec-solr/version.rb
CHANGED
data/rspec-solr.gemspec
CHANGED
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
|
18
18
|
gem.require_path = ['lib']
|
|
19
19
|
|
|
20
|
-
gem.add_runtime_dependency 'rspec', '~> 3.
|
|
20
|
+
gem.add_runtime_dependency 'rspec', '~> 3.5'
|
|
21
21
|
gem.add_runtime_dependency 'rspec-collection_matchers'
|
|
22
22
|
|
|
23
23
|
# Development dependencies
|
|
@@ -16,12 +16,12 @@ describe RSpecSolr do
|
|
|
16
16
|
it "fails if no Solr document in response has 'fldval' for the named field" do
|
|
17
17
|
expect do
|
|
18
18
|
expect(@solr_resp_5_docs).to include('id' => 'not_there')
|
|
19
|
-
end.to raise_error.with_message a_string_including '
|
|
19
|
+
end.to raise_error.with_message a_string_including '> to include {"id" => "not_there"}'
|
|
20
20
|
end
|
|
21
21
|
it 'fails if no Solr document in response has the named field' do
|
|
22
22
|
expect do
|
|
23
23
|
expect(@solr_resp_5_docs).to include('not_there' => 'anything')
|
|
24
|
-
end.to raise_error.with_message a_string_including '
|
|
24
|
+
end.to raise_error.with_message a_string_including '> to include {"not_there" => "anything"}'
|
|
25
25
|
end
|
|
26
26
|
end # "should include('fldname'=>'fldval')"
|
|
27
27
|
|
|
@@ -53,18 +53,18 @@ describe RSpecSolr do
|
|
|
53
53
|
it 'fails if only part of expectation is met' do
|
|
54
54
|
expect do
|
|
55
55
|
expect(@solr_resp_5_docs).to include('id' => '111', 'fld' => 'not_there')
|
|
56
|
-
end.to raise_error.with_message a_string_including '
|
|
56
|
+
end.to raise_error.with_message a_string_including '> to include {"id" => "111", "fld" => "not_there"}'
|
|
57
57
|
expect do
|
|
58
58
|
expect(@solr_resp_5_docs).to include('id' => '111', 'not_there' => 'whatever')
|
|
59
|
-
end.to raise_error.with_message a_string_including '
|
|
59
|
+
end.to raise_error.with_message a_string_including '> to include {"id" => "111", "not_there" => "whatever"}'
|
|
60
60
|
expect do
|
|
61
61
|
expect(@solr_resp_5_docs).to include('id' => '222', 'fld' => 'val')
|
|
62
|
-
end.to raise_error.with_message a_string_including '
|
|
62
|
+
end.to raise_error.with_message a_string_including '> to include {"id" => "222", "fld" => "val"}'
|
|
63
63
|
end
|
|
64
64
|
it 'fails if no part of expectation is met' do
|
|
65
65
|
expect do
|
|
66
66
|
expect(@solr_resp_5_docs).to include('id' => 'not_there', 'not_there' => 'anything')
|
|
67
|
-
end.to raise_error.with_message a_string_including '
|
|
67
|
+
end.to raise_error.with_message a_string_including '> to include {"id" => "not_there", "not_there" => "anything"}'
|
|
68
68
|
end
|
|
69
69
|
end # should include('fld1'=>'val1', 'fld2'=>'val2')
|
|
70
70
|
|
|
@@ -103,12 +103,12 @@ describe RSpecSolr do
|
|
|
103
103
|
it 'fails if none of the expected values match the values in a Solr document in the response' do
|
|
104
104
|
expect do
|
|
105
105
|
expect(@solr_resp_5_docs).to include('fld' => %w(not_there also_not_there))
|
|
106
|
-
end.to raise_error.with_message a_string_including '
|
|
106
|
+
end.to raise_error.with_message a_string_including '> to include {"fld" => ["not_there", "also_not_there"]}'
|
|
107
107
|
end
|
|
108
108
|
it 'fails if only some of the expected values match the values in a Solr document in the response' do
|
|
109
109
|
expect do
|
|
110
110
|
expect(@solr_resp_5_docs).to include('fld' => %w(val1 val2 not_there))
|
|
111
|
-
end.to raise_error.with_message a_string_including '
|
|
111
|
+
end.to raise_error.with_message a_string_including '> to include {"fld" => ["val1", "val2", "not_there"]}'
|
|
112
112
|
end
|
|
113
113
|
end # should
|
|
114
114
|
|
|
@@ -156,14 +156,14 @@ describe RSpecSolr do
|
|
|
156
156
|
it 'fails if string does not match default id_field of Solr document in the response' do
|
|
157
157
|
expect do
|
|
158
158
|
expect(@solr_resp_5_docs).to include('666')
|
|
159
|
-
end.to raise_error.with_message a_string_including '
|
|
159
|
+
end.to raise_error.with_message a_string_including '> to include "666"'
|
|
160
160
|
end
|
|
161
161
|
it "fails if string doesn't match non-default id_field in the SolrResponseHash object" do
|
|
162
162
|
my_srh = @solr_resp_5_docs.clone
|
|
163
163
|
my_srh.id_field = 'fld2'
|
|
164
164
|
expect do
|
|
165
165
|
expect(my_srh).to include('val')
|
|
166
|
-
end.to raise_error.with_message a_string_including '
|
|
166
|
+
end.to raise_error.with_message a_string_including '> to include "val"'
|
|
167
167
|
end
|
|
168
168
|
end # should
|
|
169
169
|
|
|
@@ -209,25 +209,25 @@ describe RSpecSolr do
|
|
|
209
209
|
it "fails if no Strings in Array match Solr documents' id_field in the response" do
|
|
210
210
|
expect do
|
|
211
211
|
expect(@solr_resp_5_docs).to include(%w(888 899))
|
|
212
|
-
end.to raise_error.with_message a_string_including '
|
|
212
|
+
end.to raise_error.with_message a_string_including '> to include ["888", "899"]'
|
|
213
213
|
my_srh = @solr_resp_5_docs.clone
|
|
214
214
|
my_srh.id_field = 'fld2'
|
|
215
215
|
expect do
|
|
216
216
|
expect(my_srh).to include(%w(val8 val9))
|
|
217
|
-
end.to raise_error.with_message a_string_including '
|
|
217
|
+
end.to raise_error.with_message a_string_including '> to include ["val8", "val9"]'
|
|
218
218
|
end
|
|
219
219
|
it "fails if only some Strings in Array match Solr documents' id_field in the response" do
|
|
220
220
|
expect do
|
|
221
221
|
expect(@solr_resp_5_docs).to include(%w(111 222 999))
|
|
222
|
-
end.to raise_error.with_message a_string_including '
|
|
222
|
+
end.to raise_error.with_message a_string_including '> to include ["111", "222", "999"]'
|
|
223
223
|
expect do
|
|
224
224
|
expect(@solr_resp_5_docs).to include(%w(666 555))
|
|
225
|
-
end.to raise_error.with_message a_string_including '
|
|
225
|
+
end.to raise_error.with_message a_string_including '> to include ["666", "555"]'
|
|
226
226
|
my_srh = @solr_resp_5_docs.clone
|
|
227
227
|
my_srh.id_field = 'fld2'
|
|
228
228
|
expect do
|
|
229
229
|
expect(my_srh).to include(%w(val2 val9))
|
|
230
|
-
end.to raise_error.with_message a_string_including '
|
|
230
|
+
end.to raise_error.with_message a_string_including '> to include ["val2", "val9"]'
|
|
231
231
|
end
|
|
232
232
|
end # should include(Array_of_Strings)
|
|
233
233
|
|
|
@@ -286,12 +286,12 @@ describe RSpecSolr do
|
|
|
286
286
|
it 'fails if no Hashes in Array match Solr documents in the response' do
|
|
287
287
|
expect do
|
|
288
288
|
expect(@solr_resp_5_docs).to include([{ 'foo' => 'bar' }, { 'bar' => 'food', 'mmm' => 'food' }])
|
|
289
|
-
end.to raise_error.with_message a_string_including '
|
|
289
|
+
end.to raise_error.with_message a_string_including '> to include [{"foo" => "bar"}, {"bar" => "food", "mmm" => "food"}]'
|
|
290
290
|
end
|
|
291
291
|
it 'fails if only some Hashes in Array match Solr documents in the response' do
|
|
292
292
|
expect do
|
|
293
293
|
expect(@solr_resp_5_docs).to include([{ 'id' => '222' }, { 'id' => '333', 'fld' => 'val' }, { 'foo' => 'bar' }, { 'bar' => 'food', 'mmm' => 'food' }])
|
|
294
|
-
end.to raise_error.with_message a_string_including '
|
|
294
|
+
end.to raise_error.with_message a_string_including '> to include [{"id" => "222"},'
|
|
295
295
|
end
|
|
296
296
|
end # should include(Array_of_Hashes)
|
|
297
297
|
|
|
@@ -331,10 +331,10 @@ describe RSpecSolr do
|
|
|
331
331
|
it 'fails if any element of Array fails' do
|
|
332
332
|
expect do
|
|
333
333
|
expect(@solr_resp_5_docs).to include(['not_there', { 'id' => '111', 'fld' => 'val' }, '555'])
|
|
334
|
-
end.to raise_error.with_message a_string_including '
|
|
334
|
+
end.to raise_error.with_message a_string_including '> to include ['
|
|
335
335
|
expect do
|
|
336
336
|
expect(@solr_resp_5_docs).to include(['222', { 'id' => '111', 'not' => 'there' }, '555'])
|
|
337
|
-
end.to raise_error.with_message a_string_including '
|
|
337
|
+
end.to raise_error.with_message a_string_including '> to include ['
|
|
338
338
|
end
|
|
339
339
|
end
|
|
340
340
|
|
|
@@ -356,12 +356,12 @@ describe RSpecSolr do
|
|
|
356
356
|
it "fails if no Solr document in response has 'fldval' for the named field" do
|
|
357
357
|
expect do
|
|
358
358
|
expect(@solr_resp_5_docs).to include('id' => /not there/)
|
|
359
|
-
end.to raise_error.with_message a_string_including '
|
|
359
|
+
end.to raise_error.with_message a_string_including '> to include {"id" => /not there/}'
|
|
360
360
|
end
|
|
361
361
|
it 'fails if no Solr document in response has the named field' do
|
|
362
362
|
expect do
|
|
363
363
|
expect(@solr_resp_5_docs).to include('not_there' => /anything/)
|
|
364
|
-
end.to raise_error.with_message a_string_including '
|
|
364
|
+
end.to raise_error.with_message a_string_including '> to include {"not_there" => /anything/}'
|
|
365
365
|
end
|
|
366
366
|
end # should include('fld' => /regex/)
|
|
367
367
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-solr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Naomi Dushay
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|
|
@@ -17,14 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - "~>"
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '3.
|
|
20
|
+
version: '3.5'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '3.
|
|
27
|
+
version: '3.5'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: rspec-collection_matchers
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
183
183
|
version: '0'
|
|
184
184
|
requirements: []
|
|
185
185
|
rubyforge_project:
|
|
186
|
-
rubygems_version: 2.
|
|
186
|
+
rubygems_version: 2.6.11
|
|
187
187
|
signing_key:
|
|
188
188
|
specification_version: 4
|
|
189
189
|
summary: RSpec custom matchers for Solr response objects
|
|
@@ -198,4 +198,3 @@ test_files:
|
|
|
198
198
|
- spec/number_of_documents_spec.rb
|
|
199
199
|
- spec/solr_response_hash_spec.rb
|
|
200
200
|
- spec/spec_helper.rb
|
|
201
|
-
has_rdoc:
|