about summary refs log tree commit diff
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2018-12-10 01:19:28 +0900
committerYamagishi Kazutoshi <ykzts@desire.sh>2018-12-10 01:19:28 +0900
commitae3d2f446a60269740a72969d74fa57168530c97 (patch)
tree28b128c5896257754028f8f5622fc011b058301c
parent81bda7d67c984c9bfcb5bca94e50cec6405b492e (diff)
Add specs for Admin::InvitesController (#9471)
-rw-r--r--spec/controllers/admin/invites_controller_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/admin/invites_controller_spec.rb b/spec/controllers/admin/invites_controller_spec.rb
index 34b51a6aa..449a699e4 100644
--- a/spec/controllers/admin/invites_controller_spec.rb
+++ b/spec/controllers/admin/invites_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe Admin::InvitesController do
@@ -40,4 +42,18 @@ describe Admin::InvitesController do
       expect(invite.reload).to be_expired
     end
   end
+
+  describe 'POST #deactivate_all' do
+    it 'expires all invites, then redirects to admin_invites_path' do
+      invites = Fabricate.times(2, :invite, expires_at: nil)
+
+      post :deactivate_all
+
+      invites.each do |invite|
+        expect(invite.reload).to be_expired
+      end
+
+      expect(response).to redirect_to admin_invites_path
+    end
+  end
 end