Skip to content

Commit ed74d3d

Browse files
ysksnhiyuki2578
authored andcommitted
Add spec for AccountableConcern#log_action (mastodon#9559)
1 parent 0953f5c commit ed74d3d

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe AccountableConcern do
6+
class Hoge
7+
include AccountableConcern
8+
attr_reader :current_account
9+
10+
def initialize(current_account)
11+
@current_account = current_account
12+
end
13+
end
14+
15+
let(:user) { Fabricate(:user, account: Fabricate(:account)) }
16+
let(:target) { Fabricate(:user, account: Fabricate(:account)) }
17+
let(:hoge) { Hoge.new(user.account) }
18+
19+
describe '#log_action' do
20+
it 'creates Admin::ActionLog' do
21+
expect do
22+
hoge.log_action(:create, target.account)
23+
end.to change { Admin::ActionLog.count }.by(1)
24+
end
25+
end
26+
end

0 commit comments

Comments
 (0)