aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-11-14 09:20:10 +0100
committerRobert2017-11-17 14:57:36 +0100
commitc0fa9f7de85fe32e95c7a923bb791525e0674c5d (patch)
tree26a5c333bdc76b3239482bc951ec4781f1d7054a
parent83f193ee59af778a46f43fee8e9092c39c1390b8 (diff)
downloadchouette-core-c0fa9f7de85fe32e95c7a923bb791525e0674c5d.tar.bz2
Fixes: #4823@0.5h; Fixed regression in Ransack button "Effacer" implicit path does not work anymore
-rw-r--r--app/views/compliance_checks/_filters.html.slim2
-rw-r--r--spec/features/compliance_ckeck_sets_spec.rb26
2 files changed, 25 insertions, 3 deletions
diff --git a/app/views/compliance_checks/_filters.html.slim b/app/views/compliance_checks/_filters.html.slim
index 902fb0735..0d747da27 100644
--- a/app/views/compliance_checks/_filters.html.slim
+++ b/app/views/compliance_checks/_filters.html.slim
@@ -43,5 +43,5 @@
wrapper_html: {class: 'checkbox_list'}
.actions
- = link_to t('actions.erase'), @compliance_check_set, class: 'btn btn-link'
+ = link_to t('actions.erase'), executed_compliance_check_set_path(@compliance_check_set), class: 'btn btn-link'
= f.submit t('actions.filter'), class: 'btn btn-default', id: 'compliance_check_set_compliance_checks_filter_btn'
diff --git a/spec/features/compliance_ckeck_sets_spec.rb b/spec/features/compliance_ckeck_sets_spec.rb
index 66cbcd8b6..7ba64b6b8 100644
--- a/spec/features/compliance_ckeck_sets_spec.rb
+++ b/spec/features/compliance_ckeck_sets_spec.rb
@@ -17,7 +17,9 @@ RSpec.describe "ComplianceCheckSets", type: :feature do
compliance_check_set: compliance_check_set, transport_mode: 'rail', transport_submode: 'suburbanRailway')
]}
let!(:direct_checks){ make_check(nil, times: 2) + make_check(nil, severity: :error) }
- let!(:indirect_checks){ blox.map{ |block| make_check(block) } }
+ let!(:indirect_checks){ blox.flat_map{ |block| make_check(block) } }
+ let( :all_checks ){ direct_checks + indirect_checks }
+
context 'executed' do
@@ -66,9 +68,29 @@ RSpec.describe "ComplianceCheckSets", type: :feature do
end
end
end
+
+ it 'can filter the results and remove the filter' do
+ # Filter
+ check('error')
+ click_on('Filtrer')
+ all_checks.each do | check |
+ if check.criticity == 'error'
+ expect( page ).to have_content(check.code)
+ else
+ expect( page ).not_to have_content(check.code)
+ end
+ end
+
+ # Remove filter
+ click_on('Effacer')
+ all_checks.each do | check |
+ expect( page ).to have_content(check.code)
+ end
+
+ end
end
- def make_check ccblock=nil, times: 1, severity: :error
+ def make_check ccblock=nil, times: 1, severity: :warning
times.times.map do
make_one_check ccblock, severity
end