mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 12:53:44 +08:00
22 lines
501 B
Ruby
22 lines
501 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
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
|