Merge branch 'dev'
This commit is contained in:
commit
a1015517cf
25 changed files with 231 additions and 187 deletions
|
@ -1,8 +0,0 @@
|
||||||
.types-de-champs-table {
|
|
||||||
table-layout: fixed;
|
|
||||||
|
|
||||||
td {
|
|
||||||
white-space: normal;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -254,7 +254,7 @@ class Admin::ProceduresController < AdminController
|
||||||
if @procedure.try(:locked?)
|
if @procedure.try(:locked?)
|
||||||
params.require(:procedure).permit(*editable_params)
|
params.require(:procedure).permit(*editable_params)
|
||||||
else
|
else
|
||||||
params.require(:procedure).permit(*editable_params, :lien_demarche, :cerfa_flag, :for_individual, :individual_with_siret, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
|
params.require(:procedure).permit(*editable_params, :lien_demarche, :cerfa_flag, :for_individual, :individual_with_siret, :ask_birthday, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,9 @@ module NewGestionnaire
|
||||||
@search_terms = params[:q]
|
@search_terms = params[:q]
|
||||||
|
|
||||||
# exact id match?
|
# exact id match?
|
||||||
if @search_terms.to_i != 0
|
id = @search_terms.to_i
|
||||||
@dossiers = current_gestionnaire.dossiers.where(id: @search_terms.to_i) +
|
if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this.
|
||||||
current_gestionnaire.dossiers_from_avis.where(id: @search_terms.to_i)
|
@dossiers = dossiers_by_id(id)
|
||||||
@dossiers.uniq!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if @dossiers.nil?
|
if @dossiers.nil?
|
||||||
|
@ -23,5 +22,22 @@ module NewGestionnaire
|
||||||
).results
|
).results
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def dossiers_by_id(id)
|
||||||
|
dossiers = current_gestionnaire.dossiers.where(id: id) +
|
||||||
|
current_gestionnaire.dossiers_from_avis.where(id: id)
|
||||||
|
dossiers.uniq
|
||||||
|
end
|
||||||
|
|
||||||
|
def id_compatible?(number)
|
||||||
|
begin
|
||||||
|
ActiveRecord::Type::Integer.new.serialize(number)
|
||||||
|
true
|
||||||
|
rescue ActiveModel::RangeError
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -220,6 +220,7 @@ class Users::DossiersController < UsersController
|
||||||
end
|
end
|
||||||
|
|
||||||
if update_params[:individual_attributes].present? &&
|
if update_params[:individual_attributes].present? &&
|
||||||
|
update_params[:individual_attributes][:birthdate] &&
|
||||||
!/^\d{4}\-\d{2}\-\d{2}$/.match(update_params[:individual_attributes][:birthdate]) &&
|
!/^\d{4}\-\d{2}\-\d{2}$/.match(update_params[:individual_attributes][:birthdate]) &&
|
||||||
!/^\d{2}\/\d{2}\/\d{4}$/.match(update_params[:individual_attributes][:birthdate])
|
!/^\d{2}\/\d{2}\/\d{4}$/.match(update_params[:individual_attributes][:birthdate])
|
||||||
errors << "Le format de la date de naissance doit être JJ/MM/AAAA"
|
errors << "Le format de la date de naissance doit être JJ/MM/AAAA"
|
||||||
|
|
|
@ -9,8 +9,4 @@ class UserDecorator < Draper::Decorator
|
||||||
'Mme'
|
'Mme'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def birthdate_fr
|
|
||||||
birthdate.strftime('%d/%m/%Y')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,6 +79,11 @@
|
||||||
%label
|
%label
|
||||||
= f.check_box :individual_with_siret
|
= f.check_box :individual_with_siret
|
||||||
Donner la possibilité de renseigner un SIRET au cours de la construction du dossier.
|
Donner la possibilité de renseigner un SIRET au cours de la construction du dossier.
|
||||||
|
%li
|
||||||
|
.checkbox
|
||||||
|
%label
|
||||||
|
= f.check_box :ask_birthday
|
||||||
|
Demander la date de naissance.
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
.col-md-6
|
||||||
%h4 Options avancées
|
%h4 Options avancées
|
||||||
|
|
|
@ -27,11 +27,13 @@
|
||||||
%h4
|
%h4
|
||||||
Prénom *
|
Prénom *
|
||||||
= ff.text_field :prenom, { class: 'form-control', required: true }
|
= ff.text_field :prenom, { class: 'form-control', required: true }
|
||||||
.form-group
|
|
||||||
%label
|
- if @facade.procedure.ask_birthday?
|
||||||
%h4
|
.form-group
|
||||||
Date de naissance *
|
%label
|
||||||
= ff.date_field :birthdate, { value: @facade.individual.birthdate, class: 'form-control', placeholder: 'jj/mm/aaaa', required: true }
|
%h4
|
||||||
|
Date de naissance *
|
||||||
|
= ff.date_field :birthdate, { value: @facade.individual.birthdate, class: 'form-control', placeholder: 'jj/mm/aaaa', required: true }
|
||||||
|
|
||||||
%p
|
%p
|
||||||
%label{ style: 'font-weight: normal;' }
|
%label{ style: 'font-weight: normal;' }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
- if field.data.any?
|
- if field.data.any?
|
||||||
%table.collection-data.types-de-champs-table{ "aria-labelledby": "page-title" }
|
%table.collection-data{ "aria-labelledby": "page-title" }
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%td.cell-label Libelle
|
%td.cell-label Libelle
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
-# # Application Layout
|
|
||||||
-#
|
|
||||||
-# This view template is used as the layout
|
|
||||||
-# for every page that Administrate generates.
|
|
||||||
-#
|
|
||||||
-# By default, it renders:
|
|
||||||
-# - Sidebar for navigation
|
|
||||||
-# - Content for a search bar
|
|
||||||
-# (if provided by a `content_for` block in a nested page)
|
|
||||||
-# - Flashes
|
|
||||||
-# - Links to stylesheets and Javascripts
|
|
||||||
|
|
||||||
!!!
|
|
||||||
%html{ lang: I18n.locale }
|
|
||||||
%head
|
|
||||||
%meta{ charset: "utf-8" }
|
|
||||||
%meta{ content: "NOODP", :name => "ROBOTS" }
|
|
||||||
%meta{ content: "initial-scale=1", :name => "viewport" }
|
|
||||||
%title
|
|
||||||
= content_for(:title)
|
|
||||||
| #{Rails.application.class.parent_name.titlecase}
|
|
||||||
= render "stylesheet"
|
|
||||||
= stylesheet_link_tag "new_design/manager", media: "all", "data-turbolinks-track": true
|
|
||||||
= csrf_meta_tags
|
|
||||||
%body
|
|
||||||
.app-container
|
|
||||||
.sidebar
|
|
||||||
= render "sidebar"
|
|
||||||
%main.main-content{ role: "main" }
|
|
||||||
= content_for(:search)
|
|
||||||
= render "flashes"
|
|
||||||
= yield
|
|
||||||
= render "javascript"
|
|
|
@ -1,16 +0,0 @@
|
||||||
- content_for(:title) do
|
|
||||||
= display_resource_name(page.resource_name)
|
|
||||||
|
|
||||||
- content_for(:search) do
|
|
||||||
- if show_search_bar
|
|
||||||
= render "search", search_term: search_term
|
|
||||||
|
|
||||||
%header.header
|
|
||||||
%h1.header__heading#page-title
|
|
||||||
= content_for(:title)
|
|
||||||
.header__actions
|
|
||||||
= link_to 'nouveau', new_manager_administrateur_path, class: 'button'
|
|
||||||
|
|
||||||
= render "collection", collection_presenter: page, resources: resources
|
|
||||||
|
|
||||||
= paginate resources
|
|
57
app/views/manager/administrateurs/show.html.erb
Normal file
57
app/views/manager/administrateurs/show.html.erb
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<%#
|
||||||
|
# Show
|
||||||
|
|
||||||
|
This view is the template for the show page.
|
||||||
|
It renders the attributes of a resource,
|
||||||
|
as well as a link to its edit page.
|
||||||
|
|
||||||
|
## Local variables:
|
||||||
|
|
||||||
|
- `page`:
|
||||||
|
An instance of [Administrate::Page::Show][1].
|
||||||
|
Contains methods for accessing the resource to be displayed on the page,
|
||||||
|
as well as helpers for describing how each attribute of the resource
|
||||||
|
should be displayed.
|
||||||
|
|
||||||
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% content_for(:title) { "#{t("administrate.actions.show")} #{page.page_title}" } %>
|
||||||
|
<% procedure = page.resource %>
|
||||||
|
|
||||||
|
<header class="main-content__header" role="banner">
|
||||||
|
<h1 class="main-content__page-title">
|
||||||
|
<%= content_for(:title) %>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to(
|
||||||
|
"#{t("administrate.actions.edit")} #{page.page_title}",
|
||||||
|
[:edit, namespace, page.resource],
|
||||||
|
class: "button",
|
||||||
|
) if valid_action? :edit %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<% if page.resource.invitation_expired? %>
|
||||||
|
<%= link_to "renvoyer l'invitation", reinvite_manager_administrateur_path(page.resource), method: :post, class: "button" %>
|
||||||
|
<% end %>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="main-content__body">
|
||||||
|
<dl>
|
||||||
|
<% page.attributes.each do |attribute| %>
|
||||||
|
<dt class="attribute-label" id="<%= attribute.name %>">
|
||||||
|
<%= t(
|
||||||
|
"helpers.label.#{resource_name}.#{attribute.name}",
|
||||||
|
default: attribute.name.titleize,
|
||||||
|
) %>
|
||||||
|
</dt>
|
||||||
|
|
||||||
|
<dd class="attribute-data attribute-data--<%=attribute.html_class%>"
|
||||||
|
><%= render_field attribute %></dd>
|
||||||
|
<% end %>
|
||||||
|
</dl>
|
||||||
|
</section>
|
|
@ -1,20 +0,0 @@
|
||||||
%table.collection-data{ "aria-labelledby": "page-title" }
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
- collection_presenter.attribute_types.each do |attr_name, attr_type|
|
|
||||||
%th.cell-label{ class: "cell-label--#{attr_type.html_class} cell-label--#{collection_presenter.ordered_html_class(attr_name)}", scope: "col" }
|
|
||||||
= link_to(sanitized_order_params.merge(collection_presenter.order_params_for(attr_name))) do
|
|
||||||
= t("helpers.label.#{resource_name}.#{attr_name}", default: attr_name.to_s).titleize
|
|
||||||
|
|
||||||
- if collection_presenter.ordered_by?(attr_name)
|
|
||||||
%span.cell-label__sort-indicator{ class: "cell-label__sort-indicator--#{collection_presenter.ordered_html_class(attr_name)}" }
|
|
||||||
= svg_tag("administrate/sort_arrow.svg", "sort_arrow", width: "13", height: "13")
|
|
||||||
%th{ colspan: "2", scope: "col" }
|
|
||||||
|
|
||||||
%tbody
|
|
||||||
- resources.each do |resource|
|
|
||||||
%tr.table__row{ role: "link", tabindex: "0", "data-url": polymorphic_path([namespace, resource]) }
|
|
||||||
- collection_presenter.attributes_for(resource).each do |attribute|
|
|
||||||
%td.cell-data{ class: "cell-data--#{attribute.html_class}" }
|
|
||||||
= link_to polymorphic_path([namespace, resource]), class: "action-show table__link-plain" do
|
|
||||||
= render_field attribute
|
|
|
@ -1,5 +0,0 @@
|
||||||
- if flash.any?
|
|
||||||
.flashes
|
|
||||||
- flash.each do |key, value|
|
|
||||||
.flash{ class: "flash--#{key}" }
|
|
||||||
= value
|
|
|
@ -1,9 +0,0 @@
|
||||||
- Administrate::Engine.javascripts.each do |js_path|
|
|
||||||
= javascript_include_tag js_path
|
|
||||||
|
|
||||||
= yield :javascript
|
|
||||||
|
|
||||||
- if Rails.env.test?
|
|
||||||
= javascript_tag do
|
|
||||||
$.fx.off = true;
|
|
||||||
$.ajaxSetup({ async: false });
|
|
26
app/views/manager/application/_navigation.html.erb
Normal file
26
app/views/manager/application/_navigation.html.erb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<%#
|
||||||
|
# Navigation
|
||||||
|
|
||||||
|
This partial is used to display the navigation in Administrate.
|
||||||
|
By default, the navigation contains navigation links
|
||||||
|
for all resources in the admin dashboard,
|
||||||
|
as defined by the routes in the `admin/` namespace
|
||||||
|
%>
|
||||||
|
|
||||||
|
<nav class="navigation" role="navigation">
|
||||||
|
<%= link_to "Se déconnecter", manager_sign_out_path, method: :delete, class: "navigation__link" %>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<% Administrate::Namespace.new(namespace).resources.each do |resource| %>
|
||||||
|
<%= link_to(
|
||||||
|
display_resource_name(resource),
|
||||||
|
[namespace, resource.path],
|
||||||
|
class: "navigation__link navigation__link--#{nav_link_state(resource)}"
|
||||||
|
) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<%= link_to "Delayed Job", manager_delayed_job_path, class: "navigation__link" %>
|
||||||
|
</nav>
|
|
@ -1,16 +0,0 @@
|
||||||
%ul.sidebar__list
|
|
||||||
%li
|
|
||||||
= link_to "Se déconnecter", manager_sign_out_path, method: :delete, class: "sidebar__link"
|
|
||||||
|
|
||||||
%hr{ style: "margin-bottom: 0;" }
|
|
||||||
|
|
||||||
%ul.sidebar__list
|
|
||||||
- Administrate::Namespace.new(namespace).resources.each do |resource|
|
|
||||||
%li
|
|
||||||
= link_to(display_resource_name(resource), [namespace, resource], class: "sidebar__link sidebar__link--#{nav_link_state(resource)}")
|
|
||||||
|
|
||||||
%hr{ style: "margin-bottom: 0;" }
|
|
||||||
|
|
||||||
%ul.sidebar__list
|
|
||||||
%li
|
|
||||||
= link_to "Delayed Job", manager_delayed_job_path, class: "sidebar__link"
|
|
|
@ -1,15 +0,0 @@
|
||||||
- content_for(:title) do
|
|
||||||
= display_resource_name(page.resource_name)
|
|
||||||
|
|
||||||
- content_for(:search) do
|
|
||||||
- if show_search_bar
|
|
||||||
= render "search", search_term: search_term
|
|
||||||
|
|
||||||
%header.header
|
|
||||||
%h1.header__heading#page-title
|
|
||||||
= content_for(:title)
|
|
||||||
.header__actions
|
|
||||||
|
|
||||||
= render "collection", collection_presenter: page, resources: resources
|
|
||||||
|
|
||||||
= paginate resources
|
|
|
@ -1,13 +0,0 @@
|
||||||
- content_for(:title) { page.page_title }
|
|
||||||
|
|
||||||
%header.header
|
|
||||||
%h1.header__heading= content_for(:title)
|
|
||||||
.header__actions
|
|
||||||
|
|
||||||
%dl
|
|
||||||
- page.attributes.each do |attribute|
|
|
||||||
%dt.attribute-label
|
|
||||||
= t("helpers.label.#{resource_name}.#{attribute.name}", default: attribute.name.titleize)
|
|
||||||
|
|
||||||
%dd.attribute-data{ class: "attribute-data--#{attribute.html_class}" }
|
|
||||||
= render_field attribute
|
|
57
app/views/manager/procedures/show.html.erb
Normal file
57
app/views/manager/procedures/show.html.erb
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<%#
|
||||||
|
# Show
|
||||||
|
|
||||||
|
This view is the template for the show page.
|
||||||
|
It renders the attributes of a resource,
|
||||||
|
as well as a link to its edit page.
|
||||||
|
|
||||||
|
## Local variables:
|
||||||
|
|
||||||
|
- `page`:
|
||||||
|
An instance of [Administrate::Page::Show][1].
|
||||||
|
Contains methods for accessing the resource to be displayed on the page,
|
||||||
|
as well as helpers for describing how each attribute of the resource
|
||||||
|
should be displayed.
|
||||||
|
|
||||||
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% content_for(:title) { "#{t("administrate.actions.show")} #{page.page_title}" } %>
|
||||||
|
<% procedure = page.resource %>
|
||||||
|
|
||||||
|
<header class="main-content__header" role="banner">
|
||||||
|
<h1 class="main-content__page-title">
|
||||||
|
<%= content_for(:title) %>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to(
|
||||||
|
"#{t("administrate.actions.edit")} #{page.page_title}",
|
||||||
|
[:edit, namespace, page.resource],
|
||||||
|
class: "button",
|
||||||
|
) if valid_action? :edit %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<% if !procedure.whitelisted? %>
|
||||||
|
<%= link_to 'whitelister', whitelist_manager_procedure_path(procedure), method: :post, class: 'button' %>
|
||||||
|
<% end %>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="main-content__body">
|
||||||
|
<dl>
|
||||||
|
<% page.attributes.each do |attribute| %>
|
||||||
|
<dt class="attribute-label" id="<%= attribute.name %>">
|
||||||
|
<%= t(
|
||||||
|
"helpers.label.#{resource_name}.#{attribute.name}",
|
||||||
|
default: attribute.name.titleize,
|
||||||
|
) %>
|
||||||
|
</dt>
|
||||||
|
|
||||||
|
<dd class="attribute-data attribute-data--<%=attribute.html_class%>"
|
||||||
|
><%= render_field attribute %></dd>
|
||||||
|
<% end %>
|
||||||
|
</dl>
|
||||||
|
</section>
|
|
@ -1,16 +0,0 @@
|
||||||
- content_for(:title) { page.page_title }
|
|
||||||
- procedure = page.resource
|
|
||||||
|
|
||||||
%header.header
|
|
||||||
%h1.header__heading= content_for(:title)
|
|
||||||
.header__actions
|
|
||||||
- if !procedure.whitelisted?
|
|
||||||
= link_to 'whitelister', whitelist_manager_procedure_path(procedure), method: :post, class: 'button'
|
|
||||||
|
|
||||||
%dl
|
|
||||||
- page.attributes.each do |attribute|
|
|
||||||
%dt.attribute-label
|
|
||||||
= t("helpers.label.#{resource_name}.#{attribute.name}", default: attribute.name.titleize)
|
|
||||||
|
|
||||||
%dd.attribute-data{ class: "attribute-data--#{attribute.html_class}" }
|
|
||||||
= render_field attribute
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddAskBirthdayToProcedure < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
add_column :procedures, :ask_birthday, :boolean, default: false, null: false
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20180201163642) do
|
ActiveRecord::Schema.define(version: 20180206153121) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -382,6 +382,7 @@ ActiveRecord::Schema.define(version: 20180201163642) do
|
||||||
t.datetime "hidden_at"
|
t.datetime "hidden_at"
|
||||||
t.datetime "archived_at"
|
t.datetime "archived_at"
|
||||||
t.datetime "whitelisted_at"
|
t.datetime "whitelisted_at"
|
||||||
|
t.boolean "ask_birthday", default: false, null: false
|
||||||
t.index ["hidden_at"], name: "index_procedures_on_hidden_at", using: :btree
|
t.index ["hidden_at"], name: "index_procedures_on_hidden_at", using: :btree
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,17 @@ describe NewGestionnaire::RechercheController, type: :controller do
|
||||||
expect(assigns(:dossiers).count).to eq(0)
|
expect(assigns(:dossiers).count).to eq(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with an id out of range' do
|
||||||
|
let(:query) { 123456789876543234567 }
|
||||||
|
|
||||||
|
it { is_expected.to have_http_status(200) }
|
||||||
|
|
||||||
|
it 'does not return the dossier' do
|
||||||
|
subject
|
||||||
|
expect(assigns(:dossiers).count).to eq(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ feature 'As a User I wanna create a dossier' do
|
||||||
|
|
||||||
context 'Right after sign_in I shall see inscription by credentials/siret, I can create a new Dossier' do
|
context 'Right after sign_in I shall see inscription by credentials/siret, I can create a new Dossier' do
|
||||||
let(:procedure_with_siret) { create(:procedure, :published, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
|
let(:procedure_with_siret) { create(:procedure, :published, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
|
||||||
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
|
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative, ask_birthday: ask_birthday) }
|
||||||
|
|
||||||
context 'Identification for individual' do
|
context 'Identification for individual' do
|
||||||
before do
|
before do
|
||||||
|
@ -18,26 +18,44 @@ feature 'As a User I wanna create a dossier' do
|
||||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "with a proper date input field for birthdate (type='date' supported)" do
|
context "when birthday is asked" do
|
||||||
fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14'
|
let(:ask_birthday) { true }
|
||||||
page.find_by_id('etape_suivante').click
|
|
||||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
scenario "with a proper date input field for birthdate (type='date' supported)" do
|
||||||
page.find_by_id('etape_suivante').click
|
fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14'
|
||||||
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
page.find_by_id('etape_suivante').click
|
||||||
page.find_by_id('suivant').click
|
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||||
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
page.find_by_id('etape_suivante').click
|
||||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||||
|
page.find_by_id('suivant').click
|
||||||
|
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
||||||
|
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "with a basic text input field for birthdate (type='date' unsupported)" do
|
||||||
|
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
||||||
|
page.find_by_id('etape_suivante').click
|
||||||
|
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||||
|
page.find_by_id('etape_suivante').click
|
||||||
|
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||||
|
page.find_by_id('suivant').click
|
||||||
|
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
||||||
|
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "with a basic text input field for birthdate (type='date' unsupported)" do
|
context "when birthday is not asked" do
|
||||||
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
let(:ask_birthday) { false }
|
||||||
page.find_by_id('etape_suivante').click
|
|
||||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
scenario "no need for birthday" do
|
||||||
page.find_by_id('etape_suivante').click
|
page.find_by_id('etape_suivante').click
|
||||||
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||||
page.find_by_id('suivant').click
|
page.find_by_id('etape_suivante').click
|
||||||
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
page.find_by_id('suivant').click
|
||||||
|
expect(user.dossiers.first.individual.birthdate).to eq(nil)
|
||||||
|
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature 'As a User I want to sort and paginate dossiers', js: true do
|
feature 'As a User I want to sort and paginate dossiers', js: true do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let(:procedure_for_individual) { create(:procedure, :published, :for_individual) }
|
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, ask_birthday: true) }
|
||||||
|
|
||||||
before "Create dossier" do
|
before "Create dossier" do
|
||||||
login_as user, scope: :user
|
login_as user, scope: :user
|
||||||
|
|
Loading…
Reference in a new issue