harvestdor-indexer 1.0.0 → 1.0.3
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/README.rdoc +1 -0
- data/harvestdor-indexer.gemspec +1 -1
- data/lib/harvestdor-indexer.rb +12 -2
- data/lib/harvestdor-indexer/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/before_all_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/cant_find_whitelist_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/empty_array_no_blacklist_config_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/empty_array_no_whitelist_config_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_collection_druids_call.yml +18 -20
- data/spec/fixtures/vcr_cassettes/ignore_druids_in_blacklist_and_whitelist_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/ignore_druids_in_blacklist_call.yml +61 -20
- data/spec/fixtures/vcr_cassettes/know_what_is_in_blacklist_call.yml +46 -0
- data/spec/fixtures/vcr_cassettes/know_what_is_in_whitelist_call.yml +46 -0
- data/spec/fixtures/vcr_cassettes/load_blacklist_once_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/load_whitelist_once_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/no_blacklist_config_call.yml +61 -20
- data/spec/fixtures/vcr_cassettes/no_blacklist_found_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/no_whitelist_config_call.yml +61 -20
- data/spec/fixtures/vcr_cassettes/process_druids_whitelist_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/rsolr_client_config_call.yml +48 -0
- data/spec/fixtures/vcr_cassettes/single_rsolr_connection_call.yml +61 -20
- data/spec/unit/harvestdor-indexer_spec.rb +114 -72
- metadata +30 -6
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://127.0.0.1:3000/
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
X-Frame-Options:
|
22
|
+
- SAMEORIGIN
|
23
|
+
X-Xss-Protection:
|
24
|
+
- 1; mode=block
|
25
|
+
X-Content-Type-Options:
|
26
|
+
- nosniff
|
27
|
+
Content-Type:
|
28
|
+
- application/xml; charset=utf-8
|
29
|
+
Etag:
|
30
|
+
- '"444bcb3a3fcf8389296c49467f27e1d6"'
|
31
|
+
Cache-Control:
|
32
|
+
- max-age=0, private, must-revalidate
|
33
|
+
X-Meta-Request-Version:
|
34
|
+
- 0.3.4
|
35
|
+
X-Request-Id:
|
36
|
+
- 3f57f369-8d39-43dc-b15e-dc7a7f37d25e
|
37
|
+
X-Runtime:
|
38
|
+
- '0.003776'
|
39
|
+
Connection:
|
40
|
+
- close
|
41
|
+
Server:
|
42
|
+
- thin 1.6.2 codename Doc Brown
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ok
|
46
|
+
http_version:
|
47
|
+
recorded_at: Wed, 12 Nov 2014 18:46:07 GMT
|
48
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://127.0.0.1:3000/
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
X-Frame-Options:
|
22
|
+
- SAMEORIGIN
|
23
|
+
X-Xss-Protection:
|
24
|
+
- 1; mode=block
|
25
|
+
X-Content-Type-Options:
|
26
|
+
- nosniff
|
27
|
+
Content-Type:
|
28
|
+
- application/xml; charset=utf-8
|
29
|
+
Etag:
|
30
|
+
- '"444bcb3a3fcf8389296c49467f27e1d6"'
|
31
|
+
Cache-Control:
|
32
|
+
- max-age=0, private, must-revalidate
|
33
|
+
X-Meta-Request-Version:
|
34
|
+
- 0.3.4
|
35
|
+
X-Request-Id:
|
36
|
+
- f3fe5cb0-9a23-4906-bf4b-2e7f236a53a9
|
37
|
+
X-Runtime:
|
38
|
+
- '0.003822'
|
39
|
+
Connection:
|
40
|
+
- close
|
41
|
+
Server:
|
42
|
+
- thin 1.6.2 codename Doc Brown
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ok
|
46
|
+
http_version:
|
47
|
+
recorded_at: Wed, 12 Nov 2014 18:50:01 GMT
|
48
|
+
recorded_with: VCR 2.9.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://127.0.0.1:3000/
|
5
|
+
uri: http://127.0.0.1:3000/
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -14,7 +14,7 @@ http_interactions:
|
|
14
14
|
response:
|
15
15
|
status:
|
16
16
|
code: 200
|
17
|
-
message:
|
17
|
+
message: OK
|
18
18
|
headers:
|
19
19
|
X-Frame-Options:
|
20
20
|
- SAMEORIGIN
|
@@ -23,36 +23,77 @@ http_interactions:
|
|
23
23
|
X-Content-Type-Options:
|
24
24
|
- nosniff
|
25
25
|
Content-Type:
|
26
|
-
-
|
26
|
+
- text/html; charset=utf-8
|
27
27
|
Etag:
|
28
|
-
- '"
|
28
|
+
- '"444bcb3a3fcf8389296c49467f27e1d6"'
|
29
29
|
Cache-Control:
|
30
30
|
- max-age=0, private, must-revalidate
|
31
|
+
X-Meta-Request-Version:
|
32
|
+
- 0.3.4
|
31
33
|
X-Request-Id:
|
32
|
-
-
|
34
|
+
- 4fef0b48-9ee9-4ef8-811e-78b8c0f643f0
|
33
35
|
X-Runtime:
|
34
|
-
- '0.
|
36
|
+
- '0.005477'
|
37
|
+
Connection:
|
38
|
+
- close
|
35
39
|
Server:
|
36
|
-
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
- thin 1.6.2 codename Doc Brown
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ok
|
44
|
+
http_version:
|
45
|
+
recorded_at: Wed, 12 Nov 2014 19:34:02 GMT
|
46
|
+
- request:
|
47
|
+
method: get
|
48
|
+
uri: http://127.0.0.1:3000/collections/yg867hg1375
|
49
|
+
body:
|
50
|
+
encoding: US-ASCII
|
51
|
+
string: ''
|
52
|
+
headers:
|
53
|
+
Accept:
|
54
|
+
- '*/*'
|
55
|
+
User-Agent:
|
56
|
+
- Ruby
|
57
|
+
response:
|
58
|
+
status:
|
59
|
+
code: 200
|
60
|
+
message: OK
|
61
|
+
headers:
|
62
|
+
X-Frame-Options:
|
63
|
+
- SAMEORIGIN
|
64
|
+
X-Xss-Protection:
|
65
|
+
- 1; mode=block
|
66
|
+
X-Content-Type-Options:
|
67
|
+
- nosniff
|
68
|
+
Content-Type:
|
69
|
+
- application/json; charset=utf-8
|
70
|
+
Etag:
|
71
|
+
- '"c3a375a17d64792857f21d1af227ed7b"'
|
72
|
+
Cache-Control:
|
73
|
+
- max-age=0, private, must-revalidate
|
74
|
+
X-Meta-Request-Version:
|
75
|
+
- 0.3.4
|
76
|
+
X-Request-Id:
|
77
|
+
- 26936654-94cb-4135-b867-53f9ba72d1b5
|
78
|
+
X-Runtime:
|
79
|
+
- '0.011706'
|
41
80
|
Connection:
|
42
|
-
-
|
81
|
+
- close
|
82
|
+
Server:
|
83
|
+
- thin 1.6.2 codename Doc Brown
|
43
84
|
body:
|
44
85
|
encoding: US-ASCII
|
45
|
-
string: '{"
|
46
|
-
E. Stafford photographs, 1909-1933"
|
86
|
+
string: '{"collections":[{"druid":"druid:yg867hg1375","latest_change":"2013-11-11T23:34:29Z","title":"Francis
|
87
|
+
E. Stafford photographs, 1909-1933"}],"items":[{"druid":"druid:jf275fd6276","latest_change":"2013-11-11T23:34:29Z","title":"Album
|
47
88
|
A: Photographs of China''s natural landscapes, urban scenes, cultural landmarks,
|
48
|
-
social customs, and people."
|
49
|
-
E: Photographs of the Seventh Day Adventist Church missionaries in China"
|
89
|
+
social customs, and people."},{"druid":"druid:nz353cp1092","latest_change":"2013-11-11T23:34:29Z","title":"Album
|
90
|
+
E: Photographs of the Seventh Day Adventist Church missionaries in China"},{"druid":"druid:tc552kq0798","latest_change":"2013-11-11T23:34:29Z","title":"Album
|
50
91
|
D: Photographs of China''s natural landscapes, urban scenes, cultural landmarks,
|
51
|
-
social customs, and people."
|
92
|
+
social customs, and people."},{"druid":"druid:th998nk0722","latest_change":"2013-11-11T23:34:29Z","title":"Album
|
52
93
|
C: Photographs of the Chinese Revolution of 1911 and the Shanghai Commercial
|
53
|
-
Press"
|
94
|
+
Press"},{"druid":"druid:ww689vs6534","latest_change":"2013-11-11T23:34:29Z","title":"Album
|
54
95
|
B: Photographs of China''s natural landscapes, urban scenes, cultural landmarks,
|
55
|
-
social customs, and people."
|
96
|
+
social customs, and people."}],"counts":{"collections":1,"items":5,"total_count":6}}'
|
56
97
|
http_version:
|
57
|
-
recorded_at: Wed,
|
98
|
+
recorded_at: Wed, 12 Nov 2014 19:34:02 GMT
|
58
99
|
recorded_with: VCR 2.9.3
|
@@ -3,15 +3,17 @@ require 'spec_helper'
|
|
3
3
|
describe Harvestdor::Indexer do
|
4
4
|
|
5
5
|
before(:all) do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
VCR.use_cassette('before_all_call') do
|
7
|
+
@config_yml_path = File.join(File.dirname(__FILE__), "..", "config", "ap.yml")
|
8
|
+
@client_config_path = File.join(File.dirname(__FILE__), "../..", "config", "dor-fetcher-client.yml")
|
9
|
+
@indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path)
|
10
|
+
require 'yaml'
|
11
|
+
@yaml = YAML.load_file(@config_yml_path)
|
12
|
+
@hdor_client = @indexer.send(:harvestdor_client)
|
13
|
+
@fake_druid = 'oo000oo0000'
|
14
|
+
@blacklist_path = File.join(File.dirname(__FILE__), "../config/ap_blacklist.txt")
|
15
|
+
@whitelist_path = File.join(File.dirname(__FILE__), "../config/ap_whitelist.txt")
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
19
|
# The method that sends the solr document to solr
|
@@ -56,8 +58,8 @@ describe Harvestdor::Indexer do
|
|
56
58
|
end
|
57
59
|
|
58
60
|
it "should initialize the harvestdor_client from the config" do
|
59
|
-
@hdor_client.
|
60
|
-
@hdor_client.config.default_set.
|
61
|
+
expect(@hdor_client).to be_an_instance_of(Harvestdor::Client)
|
62
|
+
expect(@hdor_client.config.default_set).to eq(@yaml['default_set'])
|
61
63
|
end
|
62
64
|
|
63
65
|
context "harvest_and_index" do
|
@@ -86,38 +88,44 @@ describe Harvestdor::Indexer do
|
|
86
88
|
|
87
89
|
it "should not process druids in blacklist" do
|
88
90
|
VCR.use_cassette('ignore_druids_in_blacklist_call') do
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
91
|
+
lambda{
|
92
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:blacklist => @blacklist_path})
|
93
|
+
hdor_client = indexer.send(:harvestdor_client)
|
94
|
+
indexer.dor_fetcher_client.should_receive(:druid_array).and_return(["druid:yg867hg1375", "druid:jf275fd6276", "druid:nz353cp1092", "druid:tc552kq0798", "druid:th998nk0722", "druid:ww689vs6534"])
|
95
|
+
indexer.solr_client.should_receive(:add).with(hash_including({:id => 'druid:nz353cp1092'}))
|
96
|
+
indexer.solr_client.should_not_receive(:add).with(hash_including({:id => 'druid:jf275fd6276'}))
|
97
|
+
indexer.solr_client.should_not_receive(:add).with(hash_including({:id => 'druid:tc552kq0798'}))
|
98
|
+
indexer.solr_client.should_receive(:add).with(hash_including({:id => 'druid:th998nk0722'}))
|
99
|
+
indexer.solr_client.should_receive(:commit)
|
100
|
+
indexer.harvest_and_index
|
101
|
+
}
|
98
102
|
end
|
99
103
|
end
|
100
104
|
it "should not process druid if it is in both blacklist and whitelist" do
|
101
105
|
VCR.use_cassette('ignore_druids_in_blacklist_and_whitelist_call') do
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
lambda{
|
107
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:blacklist => @blacklist_path, :whitelist => @whitelist_path})
|
108
|
+
hdor_client = indexer.send(:harvestdor_client)
|
109
|
+
indexer.dor_fetcher_client.should_not_receive(:druid_array)
|
110
|
+
indexer.solr_client.should_receive(:add).with(hash_including({:id => 'druid:yg867hg1375'}))
|
111
|
+
indexer.solr_client.should_not_receive(:add).with(hash_including({:id => 'druid:jf275fd6276'}))
|
112
|
+
indexer.solr_client.should_receive(:commit)
|
113
|
+
indexer.harvest_and_index
|
114
|
+
}
|
109
115
|
end
|
110
116
|
end
|
111
117
|
it "should only process druids in whitelist if it exists" do
|
112
118
|
VCR.use_cassette('process_druids_whitelist_call') do
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
119
|
+
lambda{
|
120
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:whitelist => @whitelist_path})
|
121
|
+
hdor_client = indexer.send(:harvestdor_client)
|
122
|
+
indexer.dor_fetcher_client.should_not_receive(:druid_array)
|
123
|
+
indexer.solr_client.should_receive(:add).with(hash_including({:id => 'druid:yg867hg1375'}))
|
124
|
+
indexer.solr_client.should_receive(:add).with(hash_including({:id => 'druid:jf275fd6276'}))
|
125
|
+
indexer.solr_client.should_receive(:add).with(hash_including({:id => 'druid:nz353cp1092'}))
|
126
|
+
indexer.solr_client.should_receive(:commit)
|
127
|
+
indexer.harvest_and_index
|
128
|
+
}
|
121
129
|
end
|
122
130
|
end
|
123
131
|
|
@@ -286,81 +294,115 @@ describe Harvestdor::Indexer do
|
|
286
294
|
@indexer.send(:blacklist).size.should == 2
|
287
295
|
end
|
288
296
|
it "should be empty Array if there was no blacklist config setting" do
|
289
|
-
|
290
|
-
|
297
|
+
VCR.use_cassette('empty_array_no_blacklist_config_call') do
|
298
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path)
|
299
|
+
expect(indexer.blacklist).to eq([])
|
300
|
+
end
|
291
301
|
end
|
292
302
|
context "load_blacklist" do
|
303
|
+
it "knows what is in the blacklist" do
|
304
|
+
VCR.use_cassette('know_what_is_in_blacklist_call') do
|
305
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:blacklist => @blacklist_path})
|
306
|
+
expect(indexer.blacklist).to eq(["druid:jf275fd6276", "druid:tc552kq0798"])
|
307
|
+
end
|
308
|
+
end
|
293
309
|
it "should not be called if there was no blacklist config setting" do
|
294
310
|
VCR.use_cassette('no_blacklist_config_call') do
|
295
|
-
|
311
|
+
lambda{
|
312
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path)
|
296
313
|
|
297
|
-
|
314
|
+
indexer.should_not_receive(:load_blacklist)
|
298
315
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
316
|
+
hdor_client = indexer.send(:harvestdor_client)
|
317
|
+
indexer.dor_fetcher_client.should_receive(:druid_array).and_return([@fake_druid])
|
318
|
+
indexer.solr_client.should_receive(:add)
|
319
|
+
indexer.solr_client.should_receive(:commit)
|
320
|
+
indexer.harvest_and_index
|
321
|
+
}
|
304
322
|
end
|
305
323
|
end
|
306
324
|
it "should only try to load a blacklist once" do
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
325
|
+
VCR.use_cassette('load_blacklist_once_call') do
|
326
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:blacklist => @blacklist_path})
|
327
|
+
indexer.send(:blacklist)
|
328
|
+
File.any_instance.should_not_receive(:open)
|
329
|
+
indexer.send(:blacklist)
|
330
|
+
end
|
311
331
|
end
|
312
332
|
it "should log an error message and throw RuntimeError if it can't find the indicated blacklist file" do
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
333
|
+
VCR.use_cassette('no_blacklist_found_call') do
|
334
|
+
exp_msg = 'Unable to find list of druids at bad_path'
|
335
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:blacklist => 'bad_path'})
|
336
|
+
indexer.logger.should_receive(:fatal).with(exp_msg)
|
337
|
+
expect { indexer.send(:load_blacklist, 'bad_path') }.to raise_error(exp_msg)
|
338
|
+
end
|
317
339
|
end
|
318
340
|
end
|
319
341
|
end # blacklist
|
320
342
|
|
321
343
|
context "whitelist" do
|
344
|
+
it "knows what is in the whitelist" do
|
345
|
+
VCR.use_cassette('know_what_is_in_whitelist_call') do
|
346
|
+
lambda{
|
347
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:whitelist => @whitelist_path})
|
348
|
+
expect(indexer.whitelist).to eq(["druid:yg867hg1375", "druid:jf275fd6276", "druid:nz353cp1092"])
|
349
|
+
}
|
350
|
+
end
|
351
|
+
end
|
322
352
|
it "should be an Array with an entry for each non-empty line in the file" do
|
323
353
|
@indexer.send(:load_whitelist, @whitelist_path)
|
324
354
|
@indexer.send(:whitelist).should be_an_instance_of(Array)
|
325
355
|
@indexer.send(:whitelist).size.should == 3
|
326
356
|
end
|
327
357
|
it "should be empty Array if there was no whitelist config setting" do
|
328
|
-
|
329
|
-
|
358
|
+
VCR.use_cassette('empty_array_no_whitelist_config_call') do
|
359
|
+
lambda{
|
360
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path)
|
361
|
+
expect(indexer.whitelist).to eq([])
|
362
|
+
}
|
363
|
+
end
|
330
364
|
end
|
331
365
|
context "load_whitelist" do
|
332
366
|
it "should not be called if there was no whitelist config setting" do
|
333
367
|
VCR.use_cassette('no_whitelist_config_call') do
|
334
|
-
|
368
|
+
lambda{
|
369
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path)
|
335
370
|
|
336
|
-
|
371
|
+
indexer.should_not_receive(:load_whitelist)
|
337
372
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
373
|
+
hdor_client = indexer.send(:harvestdor_client)
|
374
|
+
indexer.dor_fetcher_client.should_receive(:druid_array).and_return([@fake_druid])
|
375
|
+
indexer.solr_client.should_receive(:add)
|
376
|
+
indexer.solr_client.should_receive(:commit)
|
377
|
+
indexer.harvest_and_index
|
378
|
+
}
|
343
379
|
end
|
344
380
|
end
|
345
381
|
it "should only try to load a whitelist once" do
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
382
|
+
VCR.use_cassette('load_whitelist_once_call') do
|
383
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:whitelist => @whitelist_path})
|
384
|
+
indexer.send(:whitelist)
|
385
|
+
File.any_instance.should_not_receive(:open)
|
386
|
+
indexer.send(:whitelist)
|
387
|
+
end
|
350
388
|
end
|
351
389
|
it "should log an error message and throw RuntimeError if it can't find the indicated whitelist file" do
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
390
|
+
VCR.use_cassette('cant_find_whitelist_call') do
|
391
|
+
exp_msg = 'Unable to find list of druids at bad_path'
|
392
|
+
indexer = Harvestdor::Indexer.new(@config_yml_path, @client_config_path, {:whitelist => 'bad_path'})
|
393
|
+
indexer.logger.should_receive(:fatal).with(exp_msg)
|
394
|
+
expect { indexer.send(:load_whitelist, 'bad_path') }.to raise_error(exp_msg)
|
395
|
+
end
|
356
396
|
end
|
357
397
|
end
|
358
398
|
end # whitelist
|
359
399
|
|
360
400
|
it "solr_client should initialize the rsolr client using the options from the config" do
|
361
|
-
|
362
|
-
|
363
|
-
|
401
|
+
VCR.use_cassette('rsolr_client_config_call') do
|
402
|
+
indexer = Harvestdor::Indexer.new(nil, @client_config_path, Confstruct::Configuration.new(:solr => { :url => 'http://localhost:2345', :a => 1 }) )
|
403
|
+
RSolr.should_receive(:connect).with(hash_including(:a => 1, :url => 'http://localhost:2345')).and_return('foo')
|
404
|
+
indexer.solr_client
|
405
|
+
end
|
364
406
|
end
|
365
407
|
|
366
408
|
end
|