discourse-user-notes/spec/user_warning_spec.rb

24 lines
603 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe UserWarning do
let(:user) { Fabricate(:user) }
let(:admin) { Fabricate(:admin) }
let(:topic) { Fabricate(:topic) }
describe 'when a user warning is created' do
context "staff notes plugin is enabled" do
before do
SiteSetting.user_notes_enabled = true
end
it "should create staff note for warning" do
UserWarning.create(topic_id: topic.id, user_id: user.id, created_by_id: admin.id)
expect(PluginStore.get('user_notes', "notes:#{user.id}")).to be_present
end
end
end
end