about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-04-29 18:25:38 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-04-30 00:25:38 +0200
commitf48cb3eb170314cba1938522c0da44af21d47e83 (patch)
treeff588793c76f7e9ef43da8082d509c6f03988709 /app
parent8325866c6101c7b63b616e7e0035080ef1af96a7 (diff)
More coverage yes more even more (#2627)
* Add coverage for admin/confirmations controller

* Coverage for statuses controller show action

* Add coverage for admin/domain_blocks controller

* Add coverage for settings/profiles#update
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/confirmations_controller.rb8
-rw-r--r--app/controllers/admin/domain_blocks_controller.rb6
2 files changed, 8 insertions, 6 deletions
diff --git a/app/controllers/admin/confirmations_controller.rb b/app/controllers/admin/confirmations_controller.rb
index 6c41999e0..2542e21ee 100644
--- a/app/controllers/admin/confirmations_controller.rb
+++ b/app/controllers/admin/confirmations_controller.rb
@@ -2,17 +2,15 @@
 
 module Admin
   class ConfirmationsController < BaseController
-    before_action :set_account
-
     def create
-      @account.user.confirm
+      account_user.confirm
       redirect_to admin_accounts_path
     end
 
     private
 
-    def set_account
-      @account = Account.find(params[:account_id])
+    def account_user
+      Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
     end
   end
 end
diff --git a/app/controllers/admin/domain_blocks_controller.rb b/app/controllers/admin/domain_blocks_controller.rb
index d40ec829b..72bf1cd0d 100644
--- a/app/controllers/admin/domain_blocks_controller.rb
+++ b/app/controllers/admin/domain_blocks_controller.rb
@@ -27,7 +27,7 @@ module Admin
 
     def destroy
       @domain_block = DomainBlock.find(params[:id])
-      UnblockDomainService.new.call(@domain_block, resource_params[:retroactive])
+      UnblockDomainService.new.call(@domain_block, retroactive_unblock?)
       redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_blocks.destroyed_msg')
     end
 
@@ -36,5 +36,9 @@ module Admin
     def resource_params
       params.require(:domain_block).permit(:domain, :severity, :reject_media, :retroactive)
     end
+
+    def retroactive_unblock?
+      resource_params[:retroactive] == '1'
+    end
   end
 end