aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/info_request_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index adc0ab676..b1d10a51d 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -407,12 +407,15 @@ describe InfoRequest do
@global_rule = mock_model(CensorRule, :apply_to_text! => nil)
@user_rule = mock_model(CensorRule, :apply_to_text! => nil)
@request_rule = mock_model(CensorRule, :apply_to_text! => nil)
+ @body_rule = mock_model(CensorRule, :apply_to_text! => nil)
@user = mock_model(User, :censor_rules => [@user_rule])
+ @body = mock_model(PublicBody, :censor_rules => [@body_rule])
@info_request = InfoRequest.new(:prominence => 'normal',
:awaiting_description => true,
:title => 'title')
@info_request.stub!(:user).and_return(@user)
@info_request.stub!(:censor_rules).and_return([@request_rule])
+ @info_request.stub!(:public_body).and_return(@body)
@text = 'some text'
CensorRule.stub!(:global).and_return(mock('global context', :all => [@global_rule]))
end
@@ -432,6 +435,11 @@ describe InfoRequest do
lambda{ @info_request.apply_censor_rules_to_text!(@text) }.should_not raise_error
end
+ it 'should apply a rule from the body associated with the request' do
+ @body_rule.should_receive(:apply_to_text!).with(@text)
+ @info_request.apply_censor_rules_to_text!(@text)
+ end
+
it 'should apply a request rule' do
@request_rule.should_receive(:apply_to_text!).with(@text)
@info_request.apply_censor_rules_to_text!(@text)