accountable_concern_spec.rb 617 B

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