From bb233e381c2607788a91534a46c89f5fae6dce06 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 19 Nov 2014 10:20:52 +0000 Subject: 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) --- spec/controllers/admin_censor_rule_controller_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spec/controllers') 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 -- cgit v1.2.3