mirror of
https://github.com/discourse/discourse.git
synced 2025-02-01 21:27:30 +08:00
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
|