aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb33
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