mirror of
https://github.com/discourse/discourse.git
synced 2024-12-19 01:18:41 +08:00
3d4faf3272
Automation (previously known as discourse-automation) is now a core plugin.
24 lines
552 B
Ruby
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
|