sort type de champ by order place
This commit is contained in:
parent
e6136e17c3
commit
26b82b620f
2 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
= form_for [:admin, @procedure], url: admin_procedure_types_de_champ_path(@procedure) , remote: true do |f|
|
||||
= render partial: 'fields', locals: { types_de_champ: @procedure.types_de_champ, f: f }
|
||||
= render partial: 'fields', locals: { types_de_champ: @procedure.types_de_champ_ordered, f: f }
|
||||
#new_type_de_champ
|
||||
= render partial: 'fields', locals: { types_de_champ: TypeDeChamp.new, f: f }
|
||||
= f.submit "Ajouter un champ", class: 'btn btn-success', id: :add_type_de_champ
|
17
spec/views/admin/types_de_champ/show.html.haml_spec.rb
Normal file
17
spec/views/admin/types_de_champ/show.html.haml_spec.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/types_de_champ/show.html.haml', type: :view do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:first_libelle) { 'salut la compagnie' }
|
||||
let(:last_libelle) { 'je suis bien sur la page' }
|
||||
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1, libelle: last_libelle) }
|
||||
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0, libelle: first_libelle) }
|
||||
before do
|
||||
procedure.reload
|
||||
assign(:procedure, procedure)
|
||||
render
|
||||
end
|
||||
it 'sorts by order place' do
|
||||
expect(rendered).to match(/#{first_libelle}.*#{last_libelle}/m)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue