about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2018-12-19 00:43:03 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-12-18 16:43:03 +0100
commitdd85700a3e06ecec424ffc9f623f9407b007b229 (patch)
treeb2ffa944623331354f6ef7061c161709d66b3ef3 /spec
parent071eb0e2022a49ced8a0fa808fb54e6f81fcb43e (diff)
Add spec for AccountableConcern#log_action (#9559)
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/concerns/accountable_concern_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/concerns/accountable_concern_spec.rb b/spec/controllers/concerns/accountable_concern_spec.rb
new file mode 100644
index 000000000..e3c06b494
--- /dev/null
+++ b/spec/controllers/concerns/accountable_concern_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+RSpec.describe AccountableConcern do
+  class Hoge
+    include AccountableConcern
+    attr_reader :current_account
+
+    def initialize(current_account)
+      @current_account = current_account
+    end
+  end
+
+  let(:user)   { Fabricate(:user, account: Fabricate(:account)) }
+  let(:target) { Fabricate(:user, account: Fabricate(:account)) }
+  let(:hoge)   { Hoge.new(user.account) }
+
+  describe '#log_action' do
+    it 'creates Admin::ActionLog' do
+      expect do
+        hoge.log_action(:create, target.account)
+      end.to change { Admin::ActionLog.count }.by(1)
+    end
+  end
+end