2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-11-21 16:32:17 +01:00
|
|
|
RSpec.describe Dossiers::BatchOperationComponent, type: :component do
|
|
|
|
include ActionView::Context
|
|
|
|
include ActionView::Helpers::FormHelper
|
|
|
|
include ActionView::Helpers::FormOptionsHelper
|
|
|
|
|
|
|
|
let(:component) do
|
|
|
|
cmp = nil
|
2022-12-02 17:16:29 +01:00
|
|
|
form_for(BatchOperation.new, url: Rails.application.routes.url_helpers.instructeur_batch_operations_path(procedure_id: 1), method: :post, data: { controller: 'batch-operation' }) do |_form|
|
|
|
|
cmp = described_class.new(statut: statut, procedure: create(:procedure))
|
2022-11-21 16:32:17 +01:00
|
|
|
end
|
|
|
|
cmp
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { render_inline(component).to_html }
|
|
|
|
context 'statut traite' do
|
|
|
|
let(:statut) { 'traites' }
|
2023-01-10 14:06:56 +01:00
|
|
|
it { is_expected.to have_button('Archiver les dossiers', disabled: true) }
|
2022-11-21 16:32:17 +01:00
|
|
|
end
|
|
|
|
|
2022-12-12 10:02:33 +01:00
|
|
|
subject { render_inline(component).to_html }
|
|
|
|
context 'statut suivis' do
|
|
|
|
let(:statut) { 'suivis' }
|
2023-01-11 11:05:19 +01:00
|
|
|
it { is_expected.to have_button('Passer les dossiers en instruction', disabled: true) }
|
2023-07-04 10:15:58 +02:00
|
|
|
it { is_expected.to have_button('Instruire les dossiers', disabled: true) }
|
2023-01-13 15:09:24 +01:00
|
|
|
it { is_expected.to have_button('Autres actions multiples', disabled: true) }
|
2023-01-13 16:31:35 +01:00
|
|
|
it { is_expected.to have_button('Repasser les dossiers en construction', disabled: true) }
|
|
|
|
it { is_expected.to have_button('Ne plus suivre les dossiers', disabled: true) }
|
2022-12-12 10:02:33 +01:00
|
|
|
end
|
|
|
|
|
2023-01-04 11:51:22 +01:00
|
|
|
context 'statut a-suivre' do
|
|
|
|
let(:statut) { 'a-suivre' }
|
2023-01-10 14:06:56 +01:00
|
|
|
it { is_expected.to have_button('Suivre les dossiers', disabled: true) }
|
2023-01-04 11:51:22 +01:00
|
|
|
end
|
|
|
|
|
2022-11-21 16:32:17 +01:00
|
|
|
context 'statut tous' do
|
|
|
|
let(:statut) { 'tous' }
|
2022-12-05 15:36:41 +01:00
|
|
|
it { is_expected.not_to have_selector('button') }
|
2022-11-21 16:32:17 +01:00
|
|
|
end
|
|
|
|
end
|