aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/models/referential/referential_lock_during_creation_spec.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/models/referential/referential_lock_during_creation_spec.rb b/spec/models/referential/referential_lock_during_creation_spec.rb
index ec2471015..1e36bd976 100644
--- a/spec/models/referential/referential_lock_during_creation_spec.rb
+++ b/spec/models/referential/referential_lock_during_creation_spec.rb
@@ -1,28 +1,28 @@
RSpec.describe Referential, type: :model do
-
+
context "when two identical Referentials are created, only one is saved" do
let( :workbench ){ create :workbench }
it "works synchronously" do
- referential_1 = build(
- :referential,
- workbench: workbench,
- organisation: workbench.organisation
- )
- referential_2 = referential_1.dup
- referential_2.slug = "#{referential_1.slug}_different"
+ referential_1 = build(
+ :referential,
+ workbench: workbench,
+ organisation: workbench.organisation
+ )
+ referential_2 = referential_1.dup
+ referential_2.slug = "#{referential_1.slug}_different"
- metadata_1 = build(:referential_metadata)
- metadata_2 = metadata_1.dup
+ metadata_1 = build(:referential_metadata)
+ metadata_2 = metadata_1.dup
- referential_1.metadatas << metadata_1
- referential_2.metadatas << metadata_2
+ referential_1.metadatas << metadata_1
+ referential_2.metadatas << metadata_2
- referential_1.save
- referential_2.save
+ referential_1.save
+ referential_2.save
- expect(referential_1).to be_persisted
- expect(referential_2).not_to be_persisted
+ expect(referential_1).to be_persisted
+ expect(referential_2).not_to be_persisted
end
it "works asynchronously", truncation: true do