aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-11-19 10:20:52 +0000
committerGareth Rees <gareth@mysociety.org>2014-11-19 11:27:22 +0000
commitbb233e381c2607788a91534a46c89f5fae6dce06 (patch)
tree5fba1c105750b4af0970f0348e6056511a2d28b6 /spec/controllers
parentb18582f2fd854a6c42a25ec82202d7d4bc675008 (diff)
Associate censor rule with something in #new
Build the CensorRule against the object that is found by an additional parameter (either :info_request_id or :user_id)
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin_censor_rule_controller_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/admin_censor_rule_controller_spec.rb b/spec/controllers/admin_censor_rule_controller_spec.rb
index 1f6e721ea..b0f66c86f 100644
--- a/spec/controllers/admin_censor_rule_controller_spec.rb
+++ b/spec/controllers/admin_censor_rule_controller_spec.rb
@@ -28,6 +28,12 @@ describe AdminCensorRuleController do
expect(assigns[:info_request]).to eq(info_request)
end
+ it 'associates the info request with the new censor rule' do
+ info_request = FactoryGirl.create(:info_request)
+ get :new, :info_request_id => info_request.id
+ expect(assigns[:censor_rule].info_request).to eq(info_request)
+ end
+
it 'does not find an info request if no info_request_id param is supplied' do
get :new
expect(assigns[:info_request]).to be_nil
@@ -43,6 +49,12 @@ describe AdminCensorRuleController do
expect(assigns[:censor_user]).to eq(user)
end
+ it 'associates the user with the new censor rule' do
+ user = FactoryGirl.create(:user)
+ get :new, :user_id => user.id
+ expect(assigns[:censor_rule].user).to eq(user)
+ end
+
it 'does not find a user if no user_id param is supplied' do
get :new
expect(assigns[:censor_user]).to be_nil