Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored Lucene #push; added Lucene module specs
- Loading branch information
1 parent
23037f5
commit c6aba28
Showing
5 changed files
with
120 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require File.dirname(__FILE__) + '/../../spec_helper' | ||
|
||
describe CouchRestRails::Views do | ||
|
||
before :each do | ||
setup_foo_bars | ||
CouchRestRails.lucene_path = 'vendor/plugins/couchrest-rails/spec/mock/lucene' | ||
end | ||
|
||
after :all do | ||
cleanup_foo_bars | ||
end | ||
|
||
describe '#push' do | ||
|
||
it "should push the Lucene search in CouchRestRails.lucene_path to a design document for the specified database" do | ||
res = CouchRestRails::Database.delete('foo') | ||
res = CouchRestRails::Database.create('foo') | ||
res = CouchRestRails::Fixtures.load('foo') | ||
res = CouchRestRails::Lucene.push('foo') | ||
db = CouchRest.database(@foo_db_url) | ||
db.get("_design/default")['fulltext'].should_not be_blank | ||
end | ||
|
||
it "should replace existing searches but issue a warning" do | ||
CouchRestRails::Tests.setup('foo') | ||
CouchRestRails::Lucene.push('foo') | ||
res = CouchRestRails::Lucene.push('foo') | ||
res.should =~ /Overwriting/ | ||
end | ||
|
||
it "should push the Lucene searches in CouchRestRails.lucene_path to a design document for all databases if * or no argument is passed" do | ||
class CouchRestRailsTestDocumentFoo < CouchRestRails::Document | ||
use_database :foo | ||
end | ||
class CouchRestRailsTestDocumentBar < CouchRestRails::Document | ||
use_database :bar | ||
end | ||
CouchRestRails::Tests.setup | ||
CouchRestRails::Lucene.push | ||
dbf = CouchRest.database(@foo_db_url) | ||
dbb = CouchRest.database(@bar_db_url) | ||
dbf.get("_design/default")['fulltext'].should_not be_blank | ||
dbb.get("_design/default")['fulltext'].should_not be_blank | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "bar": "rab"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "foo": "oof"} |