seperate expects

This commit is contained in:
Philipp Rothmann 2022-12-05 17:12:33 +01:00
parent e7281b56af
commit 8c962e5c99

View file

@ -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