discourse/plugins/automation/spec/models/user_global_notice_spec.rb
Osama Sayegh 3d4faf3272
FEATURE: Merge discourse-automation (#26432)
Automation (previously known as discourse-automation) is now a core plugin.
2024-04-03 18:20:43 +03:00

24 lines
552 B
Ruby

# frozen_string_literal: true
require_relative "../discourse_automation_helper"
describe DiscourseAutomation::UserGlobalNotice do
fab!(:user_1) { Fabricate(:user) }
describe "creating duplicates" do
it "prevents creating duplicates" do
row = {
user_id: user_1.id,
notice: "foo",
identifier: "bar",
created_at: Time.now,
updated_at: Time.now,
}
described_class.upsert(row)
expect { described_class.upsert(row) }.to raise_error(ActiveRecord::RecordNotUnique)
end
end
end