diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/users.yml | 5 | ||||
-rw-r--r-- | spec/models/xapian_spec.rb | 21 |
2 files changed, 25 insertions, 1 deletions
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml index 276909cf5..2485c95a0 100644 --- a/spec/fixtures/users.yml +++ b/spec/fixtures/users.yml @@ -10,6 +10,7 @@ bob_smith_user: email_confirmed: true admin_level: 'none' ban_text: '' + about_me: 'I like making requests about fancy dogs and naughty chickens and stuff.' silly_name_user: id: "2" name: "Silly <em>Name</em>" @@ -22,6 +23,7 @@ silly_name_user: email_confirmed: false admin_level: 'none' ban_text: '' + about_me: '' admin_user: id: "3" name: Joe Admin @@ -33,4 +35,5 @@ admin_user: created_at: 2007-11-01 10:39:15.491593 email_confirmed: false admin_level: 'super' - ban_text: ''
\ No newline at end of file + ban_text: '' + about_me: '' diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb index c2a87b969..dd7711a7d 100644 --- a/spec/models/xapian_spec.rb +++ b/spec/models/xapian_spec.rb @@ -10,6 +10,27 @@ describe User, " when indexing users with Xapian" do xapian_object.results.size.should == 1 xapian_object.results[0][:model].should == users(:silly_name_user) end + + it "should search by 'about me' text" do + user = users(:bob_smith_user) + + rebuild_xapian_index + # def InfoRequest.full_search(models, query, order, ascending, collapse, per_page, page) + xapian_object = InfoRequest.full_search([User], "stuff", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 1 + xapian_object.results[0][:model].should == user + + user.about_me = "I am really an aardvark, true story." + user.save! + update_xapian_index + + xapian_object = InfoRequest.full_search([User], "stuff", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 0 + + xapian_object = InfoRequest.full_search([User], "aardvark", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 1 + xapian_object.results[0][:model].should == user + end end describe PublicBody, " when indexing public bodies with Xapian" do |