diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-09-24 11:29:31 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-24 11:29:31 +0100 |
commit | d8deb8418b4cd26c68eb1301959e156c19b111e2 (patch) | |
tree | 99c346db95d17be9c5105ce47d5f3ac8e943e952 /spec/models/xapian_spec.rb | |
parent | 8459314b691f5b02277035219cd58f510d100a77 (diff) | |
parent | 75542416a1cc36b353ade557b1bc4f729b02423a (diff) |
Merge branch 'release/0.14'0.14
Conflicts:
locale/bg/app.po
locale/fr/app.po
locale/fr_CA/app.po
locale/he_IL/app.po
locale/hr/app.po
locale/it/app.po
locale/nb_NO/app.po
locale/pl/app.po
locale/sv/app.po
locale/vi/app.po
Diffstat (limited to 'spec/models/xapian_spec.rb')
-rw-r--r-- | spec/models/xapian_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb index 7aab9cdc6..c7c21e3a0 100644 --- a/spec/models/xapian_spec.rb +++ b/spec/models/xapian_spec.rb @@ -400,3 +400,34 @@ describe ActsAsXapian::Search, "#words_to_highlight" do end end + +describe InfoRequestEvent, " when faced with a race condition during xapian_mark_needs_index" do + + before(:each) do + load_raw_emails_data + get_fixtures_xapian_index + # Use the before create job hook to simulate a race condition with another process + # by creating an acts_as_xapian_job record for the same model + class InfoRequestEvent + def xapian_before_create_job_hook(action, model, model_id) + ActsAsXapian::ActsAsXapianJob.create!(:model => model, + :model_id => model_id, + :action => action) + end + end + end + + after(:each) do + # Reset the before create job hook + class InfoRequestEvent + def xapian_before_create_job_hook(action, model, model_id) + end + end + end + + it 'should not raise an error but should fail silently' do + ir = info_requests(:naughty_chicken_request) + ir.reindex_request_events + end + +end |