From 4e9215c718e81921cbcfe1a78cf8542b5ecb4aa3 Mon Sep 17 00:00:00 2001 From: Xinhui Date: Wed, 26 Oct 2016 11:43:02 +0200 Subject: Referential clonning refactoring + clone metadatas Refs #1863 --- spec/models/referential_spec.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'spec/models/referential_spec.rb') diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb index 9f87d0629..c76b157f8 100644 --- a/spec/models/referential_spec.rb +++ b/spec/models/referential_spec.rb @@ -8,10 +8,18 @@ describe Referential, :type => :model do #expect(referential.rule_parameter_sets.size).to eq(1) # end - it { should have_one(:referential_metadata) } + it { should have_many(:referential_metadatas) } it { should belong_to(:workbench) } - it 'should create a ReferentialCloning when a referential is cloned' do - expect { create(:referential, created_from: ref) }.to change{ReferentialCloning.count}.by(1) + context "Cloning referential" do + let(:cloned) { create(:referential, created_from: ref) } + + it 'should create a ReferentialCloning' do + expect { cloned }.to change{ReferentialCloning.count}.by(1) + end + + it 'should clone referential_metadatas' do + expect(cloned.referential_metadatas).not_to be_empty + end end end -- cgit v1.2.3