diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/public_bodies.yml | 2 | ||||
-rw-r--r-- | spec/models/public_body_spec.rb | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/spec/fixtures/public_bodies.yml b/spec/fixtures/public_bodies.yml index 3d6a4ccc6..191dd68bb 100644 --- a/spec/fixtures/public_bodies.yml +++ b/spec/fixtures/public_bodies.yml @@ -22,4 +22,4 @@ humpadink_public_body: short_name: DfH url_name: dfh created_at: 2007-10-25 10:51:01.161639 - + notes: An albatross told me!!! diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index 8fb263f7d..50c34fdc0 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -29,4 +29,26 @@ describe PublicBody, " when saving" do end +describe PublicBody, " when indexing with Xapian" do + fixtures :public_bodies + + before do + rebuild_xapian_index + end + + it "should search index the main name field" do + xapian_object = InfoRequest.full_search([PublicBody], "humpadinking", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 1 + xapian_object.results[0][:model].should == public_bodies(:humpadink_public_body) + end + + it "should search index the notes field" do + xapian_object = InfoRequest.full_search([PublicBody], "albatross", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 1 + xapian_object.results[0][:model].should == public_bodies(:humpadink_public_body) + end + +end + + |