[Fix #719] Unformat date and yes/no values in the form
This commit is contained in:
parent
121ff6417c
commit
5b955677c2
4 changed files with 43 additions and 3 deletions
15
spec/views/users/description/champs/_date.html.haml_spec.rb
Normal file
15
spec/views/users/description/champs/_date.html.haml_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/date.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :date) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/date.html.haml', champ: champ
|
||||
end
|
||||
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "2017-09-19").decorate }
|
||||
|
||||
it 'should render an input for the dossier link' do
|
||||
expect(rendered).to have_css("input[value='2017-09-19']")
|
||||
end
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/yes_no.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :yes_no) }
|
||||
|
||||
before do
|
||||
render 'users/description/champs/yes_no.html.haml', champ: champ
|
||||
end
|
||||
|
||||
context "when the value is Oui" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "true").decorate }
|
||||
|
||||
it 'should select the Oui radio button' do
|
||||
expect(rendered).to have_selector("input[value='true'][checked]")
|
||||
end
|
||||
end
|
||||
|
||||
context "when the value is Non" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "false").decorate }
|
||||
|
||||
it 'should select the Non radio button' do
|
||||
expect(rendered).to have_selector("input[value='false'][checked]")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue