From 8c962e5c99b8b60437c9244995153a58602747d7 Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Mon, 5 Dec 2022 17:12:33 +0100 Subject: [PATCH] seperate expects --- spec/controllers/articles_controller_spec.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/spec/controllers/articles_controller_spec.rb b/spec/controllers/articles_controller_spec.rb index 5e5c44a9..832f515b 100644 --- a/spec/controllers/articles_controller_spec.rb +++ b/spec/controllers/articles_controller_spec.rb @@ -12,6 +12,7 @@ describe ArticlesController, type: :controller do let(:supplier) { create :supplier, articles: [article_a, article_b] } let(:order) { create :order } + let(:order2) { create :order } def get_with_supplier(action, params: {}, xhr: false, format: nil) params['supplier_id'] = supplier.id @@ -141,7 +142,8 @@ describe ArticlesController, type: :controller do get_with_supplier :update_selected, params: { selected_articles: [article_a.id, article_b.id], selected_action: 'destroy' } article_a.reload article_b.reload - expect(article_a.deleted? && article_b.deleted?).to be_truthy + expect(article_a).to be_deleted + expect(article_b).to be_deleted expect(response).to have_http_status(:redirect) end @@ -149,7 +151,8 @@ describe ArticlesController, type: :controller do get_with_supplier :update_selected, params: { selected_articles: [article_a.id, article_b.id], selected_action: 'setNotAvailable' } article_a.reload article_b.reload - expect(article_a.availability || article_b.availability).to be_falsey + expect(article_a).not_to be_availability + expect(article_b).not_to be_availability expect(response).to have_http_status(:redirect) end @@ -157,7 +160,8 @@ describe ArticlesController, type: :controller do get_with_supplier :update_selected, params: { selected_articles: [article_a.id, article_b.id], selected_action: 'setAvailable' } article_a.reload article_b.reload - expect(article_a.availability && article_b.availability).to be_truthy + expect(article_a).to be_availability + expect(article_b).to be_availability expect(response).to have_http_status(:redirect) end @@ -165,7 +169,8 @@ describe ArticlesController, type: :controller do get_with_supplier :update_selected, params: { selected_articles: [article_a.id, article_c.id], selected_action: 'destroy' } article_a.reload article_c.reload - expect(article_a.deleted? || article_c.deleted?).to be_falsey + expect(article_a).not_to be_deleted + expect(article_c).not_to be_deleted expect(response).to have_http_status(:redirect) end end @@ -236,7 +241,8 @@ describe ArticlesController, type: :controller do get_with_supplier :update_synchronized, params: { outlisted_articles: { article_a.id => article_a, article_b.id => article_b } } article_a.reload article_b.reload - expect(article_a.deleted? && article_b.deleted?).to be_truthy + expect(article_a).to be_deleted + expect(article_b).to be_deleted expect(response).to have_http_status(:redirect) end