From: Jan Provaznik jprovazn@redhat.com
--- src/spec/models/template_spec.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/spec/models/template_spec.rb b/src/spec/models/template_spec.rb index ef30fc1..cac172c 100644 --- a/src/spec/models/template_spec.rb +++ b/src/spec/models/template_spec.rb @@ -16,4 +16,12 @@ describe Template do rimg.save tpl.providers.size.should eql(1) end + + it "should not destroy template if there are instances created from this template" do + inst = Factory.build(:instance) + inst.save! + lambda do + inst.template.destroy + end.should_not change(Template, :count) + end end