From fbba08a17a6f718e1e6ed85e528189042fc9b1da Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Thu, 8 Sep 2022 15:59:54 +0200 Subject: [PATCH] test supplier deletes articles --- spec/models/supplier_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/models/supplier_spec.rb b/spec/models/supplier_spec.rb index 72e870ed..74ef7902 100644 --- a/spec/models/supplier_spec.rb +++ b/spec/models/supplier_spec.rb @@ -3,6 +3,13 @@ require_relative '../spec_helper' describe Supplier do let(:supplier) { create :supplier } + it 'deletes the supplier and its articles' do + supplier = create :supplier, article_count: 3 + supplier.articles.each{ |a| expect(a).to receive(:mark_as_deleted)} + supplier.mark_as_deleted + expect(supplier.deleted?).to be(true) + end + it 'has a unique name' do supplier2 = build :supplier, name: supplier.name expect(supplier2).to be_invalid