2018-12-18 10:43:03 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe AccountableConcern do
|
2023-05-03 04:32:30 -04:00
|
|
|
let(:hoge_class) do
|
|
|
|
Class.new do
|
|
|
|
include AccountableConcern
|
|
|
|
attr_reader :current_account
|
2018-12-18 10:43:03 -05:00
|
|
|
|
2023-05-03 04:32:30 -04:00
|
|
|
def initialize(current_account)
|
|
|
|
@current_account = current_account
|
|
|
|
end
|
2018-12-18 10:43:03 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-01-27 18:46:42 -05:00
|
|
|
let(:user) { Fabricate(:account) }
|
|
|
|
let(:target) { Fabricate(:account) }
|
2023-05-03 04:32:30 -04:00
|
|
|
let(:hoge) { hoge_class.new(user) }
|
2018-12-18 10:43:03 -05:00
|
|
|
|
|
|
|
describe '#log_action' do
|
|
|
|
it 'creates Admin::ActionLog' do
|
|
|
|
expect do
|
2022-01-27 18:46:42 -05:00
|
|
|
hoge.log_action(:create, target)
|
2023-05-24 05:23:40 -04:00
|
|
|
end.to change(Admin::ActionLog, :count).by(1)
|
2018-12-18 10:43:03 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|