about summary refs log tree commit diff
path: root/spec/controllers/concerns/accountable_concern_spec.rb
blob: 5c5180bc24cf013789e5f351dd1b69f3972e8ee2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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(:account) }
  let(:target) { Fabricate(:account) }
  let(:hoge)   { Hoge.new(user) }

  describe '#log_action' do
    it 'creates Admin::ActionLog' do
      expect do
        hoge.log_action(:create, target)
      end.to change { Admin::ActionLog.count }.by(1)
    end
  end
end