diff options
author | louise <louise> | 2009-04-14 11:04:52 +0000 |
---|---|---|
committer | louise <louise> | 2009-04-14 11:04:52 +0000 |
commit | 1b306cc7e959cf69a0f3e5a388522a240c770cd9 (patch) | |
tree | ece1fd53152c4084efb613494dcf0bbeec3af2cf /spec/models/user_spec.rb | |
parent | 57b0fc86d03fe2ecf1036d6453391c4763eba6b4 (diff) |
Allowing xapian reindexing to be skipped if a no_xapian_reindex flag is set on the model
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 5f29ebeb6..bf90ffdfb 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -84,10 +84,37 @@ describe User, " when saving" do @user2.email = "flobble2@localhost" @user2.save! end - + + it 'should mark the model for reindexing in xapian if the no_xapian_reindex flag is set to false' do + @user.name = "Mr. First" + @user.password = "insecurepassword" + @user.email = "reasonable@localhost" + @user.no_xapian_reindex = false + @user.should_receive(:xapian_mark_needs_index) + @user.save! + end + + it 'should mark the model for reindexing in xapian if the no_xapian_reindex flag is not set' do + @user.name = "Mr. Second" + @user.password = "insecurepassword" + @user.email = "reasonable@localhost" + @user.no_xapian_reindex = nil + @user.should_receive(:xapian_mark_needs_index) + @user.save! + end + + it 'should not mark the model for reindexing in xapian if the no_xapian_reindex flag is set' do + @user.name = "Mr. Third" + @user.password = "insecurepassword" + @user.email = "reasonable@localhost" + @user.no_xapian_reindex = true + @user.should_not_receive(:xapian_mark_needs_index) + @user.save! + end end + describe User, "when reindexing referencing models" do before do @@ -108,10 +135,10 @@ describe User, "when reindexing referencing models" do @user.reindex_referencing_models end - describe 'when no_reindex is set' do + describe 'when no_xapian_reindex is set' do before do - @user.no_reindex = true + @user.no_xapian_reindex = true end it 'should not reindex events associated with that user\'s comments' do |