File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ def index_directory(directory)
3434 Find . find ( directory )
3535 . select ( &method ( :json_file? ) )
3636 . each ( &method ( :add ) )
37+ @solr . commit
3738 end
3839
3940 def update_reference_urls! ( doc )
Original file line number Diff line number Diff line change 5050
5151 describe '#index_directory' do
5252 it 'adds all .json files to solr' do
53- files = [ 'foo.xml' , 'bar.json' , 'baz.json' ] . shuffle
54- expect ( Find ) . to receive ( :find ) . with ( 'directory' ) . and_return files
5553 Gingr ::SolrIndexer . any_instance . stub ( :add )
5654
57- indexer = Gingr ::SolrIndexer . new
58- indexer . index_directory ( 'directory' )
59- expect ( indexer ) . to have_received ( :add ) . with ( 'bar.json' )
60- expect ( indexer ) . to have_received ( :add ) . with ( 'baz.json' )
61- expect ( indexer ) . not_to have_received ( :add ) . with ( 'foo.xml' )
55+ solr = spy ( RSolr ::Client )
56+ indexer = Gingr ::SolrIndexer . new ( solr )
57+ indexer . index_directory ( 'spec/fixture/jsonfile' )
58+ expect ( indexer ) . to have_received ( :add ) . with 'spec/fixture/jsonfile/actual-point.json'
59+ expect ( indexer ) . to have_received ( :add ) . with 'spec/fixture/jsonfile/berkeley_public_pdf.json'
60+ expect ( solr ) . to have_received ( :commit ) . once
6261 end
6362 end
6463
You can’t perform that action at this time.
0 commit comments