accountable_concern_spec.rb 568 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe AccountableConcern do
  4. class Hoge
  5. include AccountableConcern
  6. attr_reader :current_account
  7. def initialize(current_account)
  8. @current_account = current_account
  9. end
  10. end
  11. let(:user) { Fabricate(:account) }
  12. let(:target) { Fabricate(:account) }
  13. let(:hoge) { Hoge.new(user) }
  14. describe '#log_action' do
  15. it 'creates Admin::ActionLog' do
  16. expect do
  17. hoge.log_action(:create, target)
  18. end.to change { Admin::ActionLog.count }.by(1)
  19. end
  20. end
  21. end