diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-07-12 13:04:27 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-07-13 08:21:15 +0100 |
commit | 088bc961328f4d876971994102cde52c1ad49246 (patch) | |
tree | 26ded6a4940a23f898a688ea0b6041a21f455a53 /spec/models/info_request_spec.rb | |
parent | 39fdae7de23244b47581c197e1d78506aebf5af1 (diff) |
Support regular expressions in CensorRules; also support 'global' CensorRules that aren't attached to a User or Request or Public Body (but don't expose this in the admin UI). Fixes #33
Diffstat (limited to 'spec/models/info_request_spec.rb')
-rw-r--r-- | spec/models/info_request_spec.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index a18a4bd1d..21b26f067 100644 --- a/spec/models/info_request_spec.rb +++ b/spec/models/info_request_spec.rb @@ -399,6 +399,25 @@ describe InfoRequest do @info_request.is_old_unclassified?.should be_true end + context "with regexp censor rule" do + before do + Time.stub!(:now).and_return(Time.utc(2007, 11, 9, 23, 59)) + @info_request = InfoRequest.create!(:prominence => 'normal', + :awaiting_description => true, + :title => 'title', + :public_body => public_bodies(:geraldine_public_body), + :user_id => 1) + @censor_rule = CensorRule.create(:last_edit_editor => 1, + :last_edit_comment => 'comment', + :text => 'text', + :replacement => 'replacement', + :regexp => true) + end + it "applies regexp censor rule" do + body = 'text' + @info_request.apply_censor_rules_to_text!(body) + body.should == 'replacement' + end end - + end |