Merge branch 'develop' into staging
This commit is contained in:
commit
138b5ac498
30 changed files with 164 additions and 199 deletions
|
@ -158,6 +158,15 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
render 'backoffice/dossiers/index', formats: :js
|
||||
end
|
||||
|
||||
def archive
|
||||
facade = create_dossier_facade params[:dossier_id]
|
||||
unless facade.dossier.archived
|
||||
facade.dossier.update(archived: true)
|
||||
flash.notice = 'Dossier archivé'
|
||||
end
|
||||
redirect_to backoffice_dossiers_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_dossier_facade dossier_id
|
||||
|
|
|
@ -101,6 +101,7 @@ class Users::SessionsController < Sessions::SessionsController
|
|||
if resource = klass.find_for_database_authentication(email: params[:user][:email])
|
||||
if resource.valid_password?(params[:user][:password])
|
||||
sign_in resource
|
||||
resource.force_sync_credentials
|
||||
set_flash_message :notice, :signed_in
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,8 @@ class Administrateur < ActiveRecord::Base
|
|||
has_many :procedures
|
||||
|
||||
before_save :ensure_api_token
|
||||
after_update :sync_credentials
|
||||
|
||||
include CredentialsSyncableConcern
|
||||
|
||||
def ensure_api_token
|
||||
if api_token.nil?
|
||||
|
@ -27,10 +28,4 @@ class Administrateur < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def sync_credentials
|
||||
if email_changed? || encrypted_password_changed?
|
||||
return SyncCredentialsService.new(Administrateur, email_was, email, encrypted_password).change_credentials!
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
19
app/models/concerns/credentials_syncable_concern.rb
Normal file
19
app/models/concerns/credentials_syncable_concern.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
module CredentialsSyncableConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
after_update :sync_credentials
|
||||
end
|
||||
|
||||
def sync_credentials
|
||||
if email_changed? || encrypted_password_changed?
|
||||
return force_sync_credentials
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def force_sync_credentials
|
||||
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
|
||||
end
|
||||
|
||||
end
|
|
@ -14,7 +14,8 @@ class Gestionnaire < ActiveRecord::Base
|
|||
|
||||
after_create :build_default_preferences_list_dossier
|
||||
after_create :build_default_preferences_smart_listing_page
|
||||
after_update :sync_credentials
|
||||
|
||||
include CredentialsSyncableConcern
|
||||
|
||||
def dossiers_follow
|
||||
@dossiers_follow ||= dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")
|
||||
|
@ -119,11 +120,4 @@ class Gestionnaire < ActiveRecord::Base
|
|||
|
||||
couples.include?({table: table, column: column})
|
||||
end
|
||||
|
||||
def sync_credentials
|
||||
if email_changed? || encrypted_password_changed?
|
||||
return SyncCredentialsService.new(Gestionnaire, email_was, email, encrypted_password).change_credentials!
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,8 @@ class User < ActiveRecord::Base
|
|||
|
||||
delegate :given_name, :family_name, :email_france_connect, :gender, :birthdate, :birthplace, :france_connect_particulier_id, to: :france_connect_information
|
||||
accepts_nested_attributes_for :france_connect_information
|
||||
after_update :sync_credentials
|
||||
|
||||
include CredentialsSyncableConcern
|
||||
|
||||
def self.find_for_france_connect email, siret
|
||||
user = User.find_by_email(email)
|
||||
|
@ -35,12 +36,4 @@ class User < ActiveRecord::Base
|
|||
invites.pluck(:dossier_id).include?(dossier_id.to_i)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def sync_credentials
|
||||
if email_changed? || encrypted_password_changed?
|
||||
return SyncCredentialsService.new(User, email_was, email, encrypted_password).change_credentials!
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ class SyncCredentialsService
|
|||
unless @klass == User
|
||||
user = User.find_by(email: @email_was)
|
||||
if user
|
||||
return user.update_columns(
|
||||
return false unless user.update_columns(
|
||||
email: @email,
|
||||
encrypted_password: @encrypted_password)
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ class SyncCredentialsService
|
|||
unless @klass == Gestionnaire
|
||||
gestionnaire = Gestionnaire.find_by(email: @email_was)
|
||||
if gestionnaire
|
||||
return gestionnaire.update_columns(
|
||||
return false unless gestionnaire.update_columns(
|
||||
email: @email,
|
||||
encrypted_password: @encrypted_password)
|
||||
end
|
||||
|
@ -29,10 +29,12 @@ class SyncCredentialsService
|
|||
unless @klass == Administrateur
|
||||
administrateur = Administrateur.find_by(email: @email_was)
|
||||
if administrateur
|
||||
return administrateur.update_columns(
|
||||
return false unless administrateur.update_columns(
|
||||
email: @email,
|
||||
encrypted_password: @encrypted_password)
|
||||
end
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,11 @@
|
|||
%button.action.refuse-dossier
|
||||
%i.fa.fa-times
|
||||
|
||||
- unless @facade.dossier.archived?
|
||||
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||
|
||||
|
||||
|
||||
%div#menu-block
|
||||
|
||||
%div#infos-block
|
||||
|
@ -33,7 +38,7 @@
|
|||
%div.split-hr-left
|
||||
%div.notifications
|
||||
- if @facade.dossier.notifications.empty?
|
||||
= "Aucune notification pour le moment."
|
||||
Aucune notification pour le moment.
|
||||
- else
|
||||
%i.fa.fa-bell-o
|
||||
- @facade.last_notifications.each do |notification|
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
load Gem.bin_path('bundler', 'bundle')
|
29
bin/setup
29
bin/setup
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
Dir.chdir APP_ROOT do
|
||||
# This script is a starting point to setup your application.
|
||||
# Add necessary setup steps to this file:
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
system "gem install bundler --conservative"
|
||||
system "bundle check || bundle install"
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?("config/database.yml")
|
||||
# system "cp config/database.yml.sample config/database.yml"
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system "bin/rake db:setup"
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system "rm -f log/*"
|
||||
system "rm -rf tmp/cache"
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system "touch tmp/restart.txt"
|
||||
end
|
|
@ -172,6 +172,7 @@ Rails.application.routes.draw do
|
|||
post 'refuse' => 'dossiers#refuse'
|
||||
post 'without_continuation' => 'dossiers#without_continuation'
|
||||
post 'close' => 'dossiers#close'
|
||||
post 'archive' => 'dossiers#archive'
|
||||
|
||||
put 'follow' => 'dossiers#follow'
|
||||
resources :commentaires, only: [:index]
|
||||
|
|
|
@ -345,4 +345,23 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe 'POST #archive' do
|
||||
before do
|
||||
dossier.update(archived: false)
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :archive, params: {dossier_id: dossier_id} }
|
||||
|
||||
it 'change state to archived' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.archived).to eq(true)
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to backoffice_dossiers_path }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -84,15 +84,16 @@ describe RootController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when opensimplif features is true' do
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
|
||||
before do
|
||||
sign_in gestionnaire
|
||||
|
||||
allow_any_instance_of(Features).to receive(:opensimplif).and_return(true)
|
||||
end
|
||||
|
||||
it { expect(subject).to redirect_to(simplifications_path) }
|
||||
pending
|
||||
# let(:gestionnaire) { create(:gestionnaire) }
|
||||
#
|
||||
# before do
|
||||
# sign_in gestionnaire
|
||||
#
|
||||
# allow_any_instance_of(Features).to receive(:opensimplif).and_return(true)
|
||||
# end
|
||||
#
|
||||
# it { expect(subject).to redirect_to(simplifications_path) }
|
||||
end
|
||||
|
||||
context "unified login" do
|
||||
|
|
|
@ -100,6 +100,24 @@ describe Users::SessionsController, type: :controller do
|
|||
expect(subject.current_gestionnaire).to be(nil)
|
||||
expect(subject.current_administrateur).to be(nil)
|
||||
end
|
||||
|
||||
context 'with different passwords' do
|
||||
let!(:gestionnaire) { create(:gestionnaire, email: email, password: 'another_password') }
|
||||
let!(:administrateur) { create(:administrateur, email: email, password: 'another_password') }
|
||||
|
||||
before do
|
||||
user
|
||||
end
|
||||
|
||||
it 'should sync passwords on login' do
|
||||
post :create, params: { user: { email: email, password: password } }
|
||||
gestionnaire.reload
|
||||
administrateur.reload
|
||||
expect(user.valid_password?(password)).to be(true)
|
||||
expect(gestionnaire.valid_password?(password)).to be(true)
|
||||
expect(administrateur.valid_password?(password)).to be(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe InviteDossierFacades do
|
||||
|
||||
let(:dossier) { create :dossier }
|
||||
let(:email) { 'email@octo.com' }
|
||||
|
||||
subject { described_class.new dossier.id, email }
|
||||
|
||||
before do
|
||||
create :invite, email: email, dossier: dossier
|
||||
end
|
||||
|
||||
it { expect(subject.dossier).to eq dossier }
|
||||
end
|
|
@ -46,7 +46,6 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
end
|
||||
|
||||
context 'Editing a new procedure' do
|
||||
|
||||
before 'Create procedure' do
|
||||
page.find_by_id('new-procedure').click
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As an Accompagnateur I can navigate and use each functionnality around procedures and their dossiers', js: true do
|
||||
|
||||
feature 'As an Accompagnateur I can navigate and use each functionnality around procedures and their dossiers' do
|
||||
let(:user) { create(:user) }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:procedure_1) { create(:procedure, :with_type_de_champ, libelle: 'procedure 1') }
|
||||
|
@ -23,46 +22,46 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
context 'On index' do
|
||||
|
||||
scenario 'Switching between procedures' do
|
||||
page.all('#procedure_list a').first.trigger('click')
|
||||
page.all('#procedure_list a').first.click
|
||||
expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_1.id.to_s), only_path: true)
|
||||
expect(page.find('#all_dossiers .count').text).to eq('30 dossiers')
|
||||
page.all('#procedure_list a').last.trigger('click')
|
||||
page.all('#procedure_list a').last.click
|
||||
expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_2.id.to_s), only_path: true)
|
||||
expect(page.find('#all_dossiers .count').text).to eq('22 dossiers')
|
||||
end
|
||||
|
||||
scenario 'Searching with search bar' do
|
||||
scenario 'Searching with search bar', js: true do
|
||||
page.find_by_id('search_area').trigger('click')
|
||||
fill_in 'q', with: '15'
|
||||
page.find_by_id('search_button').trigger('click')
|
||||
page.find_by_id('tr_dossier_15').trigger('click')
|
||||
expect(page).to have_current_path("/backoffice/dossiers/15")
|
||||
fill_in 'q', with: (procedure_1.dossiers.first.id + 14)
|
||||
page.find_by_id('search_button').click
|
||||
page.find_by_id("tr_dossier_#{(procedure_1.dossiers.first.id + 14)}").click
|
||||
expect(page).to have_current_path("/backoffice/dossiers/#{(procedure_1.dossiers.first.id + 14)}")
|
||||
end
|
||||
|
||||
scenario 'Following dossier' do
|
||||
page.all('#procedure_list a').first.trigger('click')
|
||||
page.all('#procedure_list a').first.click
|
||||
expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("0")
|
||||
page.find_by_id('all_dossiers').trigger('click')
|
||||
page.find_by_id('all_dossiers').click
|
||||
expect(page.all('#dossiers_list a').first.text).to eq('Suivre')
|
||||
page.all('#dossiers_list a').first.trigger('click')
|
||||
page.all('#dossiers_list a').first.click
|
||||
expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("1")
|
||||
end
|
||||
|
||||
scenario 'Using sort and pagination' do
|
||||
visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=asc"
|
||||
scenario 'Using sort and pagination', js: true do
|
||||
visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=asc"
|
||||
wait_for_ajax
|
||||
expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq('tr_dossier_1')
|
||||
visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=desc"
|
||||
expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id}")
|
||||
visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=desc"
|
||||
wait_for_ajax
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_30')
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.last.id}")
|
||||
page.find('#all_state_dossiers .next_page a').trigger('click')
|
||||
wait_for_ajax
|
||||
page.find('#all_state_dossiers .next_page a').trigger('click')
|
||||
wait_for_ajax
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_10')
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 9}")
|
||||
page.find('#all_state_dossiers .prev a').trigger('click')
|
||||
wait_for_ajax
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_20')
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 19}")
|
||||
end
|
||||
|
||||
scenario 'Using filter' do
|
||||
|
@ -76,23 +75,25 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
end
|
||||
|
||||
context 'On show' do
|
||||
|
||||
scenario 'Following dossier' do
|
||||
expect(page.all('#follow_dossiers .count').first.text).to eq('0 dossiers')
|
||||
visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=asc"
|
||||
page.find_by_id("suivre_dossier_1").trigger('click')
|
||||
visit "backoffice/dossiers/4"
|
||||
page.find_by_id("suivre_dossier_4").trigger('click')
|
||||
visit "/backoffice/dossiers/procedure/1"
|
||||
|
||||
visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=asc"
|
||||
page.find_by_id("suivre_dossier_#{procedure_1.dossiers.first.id}").click
|
||||
|
||||
visit "/backoffice/dossiers/#{procedure_1.dossiers.second.id}"
|
||||
page.find_by_id("suivre_dossier_#{procedure_1.dossiers.second.id}").click
|
||||
|
||||
visit "/backoffice/dossiers/procedure/#{procedure_1.id}"
|
||||
expect(page.all('#follow_dossiers .count').first.text).to eq('2 dossiers')
|
||||
end
|
||||
|
||||
scenario 'Adding message' do
|
||||
page.find_by_id('tr_dossier_4').trigger('click')
|
||||
expect(page).to have_current_path(backoffice_dossier_path(4), only_path: true)
|
||||
page.find_by_id('open-message').trigger('click')
|
||||
scenario 'Adding message', js: true do
|
||||
page.find_by_id("tr_dossier_#{procedure_1.dossiers.first.id}").trigger('click')
|
||||
expect(page).to have_current_path(backoffice_dossier_path(procedure_1.dossiers.first.id), only_path: true)
|
||||
page.find_by_id('open-message').click
|
||||
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
|
||||
page.find_by_id('save-message').trigger('click')
|
||||
page.find_by_id('save-message').click
|
||||
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As an Accompagnateur I can send invitations from dossiers', js: true do
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:procedure_1) { create(:procedure, :with_type_de_champ, libelle: 'procedure 1') }
|
||||
|
||||
before 'Assign procedures to Accompagnateur and generating dossiers for each' do
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_1
|
||||
Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'initiated')
|
||||
login_as gestionnaire, scope: :gestionnaire
|
||||
visit backoffice_dossier_path(1)
|
||||
end
|
||||
|
||||
context 'On dossier show' do
|
||||
|
||||
scenario 'Sending invitation' do
|
||||
page.find('#invitations').click
|
||||
page.find('#invitation-email').set('toto@email.com')
|
||||
page.find('#send-invitation .btn-success').trigger('click')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -69,6 +69,7 @@ feature 'usage of pref list dossier lateral panel', js: true do
|
|||
end
|
||||
|
||||
scenario 'lateral panel is masked' do
|
||||
wait_for_ajax
|
||||
expect(page).to have_css('#pref_list_menu', visible: false)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,6 +35,7 @@ feature 'usage of pref list dossier lateral panel by procedure', js: true do
|
|||
end
|
||||
|
||||
scenario 'lateral panel is appeared' do
|
||||
wait_for_ajax
|
||||
expect(page).to have_css('#pref_list_menu')
|
||||
end
|
||||
|
||||
|
@ -69,6 +70,7 @@ feature 'usage of pref list dossier lateral panel by procedure', js: true do
|
|||
end
|
||||
|
||||
scenario 'lateral panel is masked' do
|
||||
wait_for_ajax
|
||||
expect(page).to have_css('#pref_list_menu', visible: false)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ feature 'on backoffice page', js: true do
|
|||
create :follow, gestionnaire: gestionnaire, dossier: dossier
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
|
||||
create :follow, gestionnaire: gestionnaire, dossier: dossier_individual
|
||||
visit backoffice_path
|
||||
visit users_path
|
||||
end
|
||||
|
||||
context 'when gestionnaire is logged in' do
|
||||
|
|
|
@ -14,7 +14,6 @@ feature 'user is on description page' do
|
|||
page.find_by_id('user_password').set dossier.user.password
|
||||
page.click_on 'Se connecter'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it { expect(page).to have_css('#description_page') }
|
||||
|
|
|
@ -61,7 +61,7 @@ feature 'user path for dossier creation' do
|
|||
context 'when validating info entreprise recap page' do
|
||||
before do
|
||||
page.check('dossier_autorisation_donnees')
|
||||
page.click_on 'Etape suivante'
|
||||
page.find_by_id('etape_suivante').trigger('click')
|
||||
end
|
||||
scenario 'user is on description page' do
|
||||
expect(page).to have_css('#description_page')
|
||||
|
@ -69,7 +69,7 @@ feature 'user path for dossier creation' do
|
|||
context 'user fill and validate description page' do
|
||||
before do
|
||||
page.find_by_id("champs_#{Dossier.last.champs.first.id}").set 'Mon super projet'
|
||||
page.click_on 'Soumettre mon dossier'
|
||||
page.find_by_id('suivant').trigger('click')
|
||||
end
|
||||
scenario 'user is on recap page' do
|
||||
expect(page).to have_css('#users_recapitulatif_dossier_show')
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As a User I wanna create a dossier', js: true do
|
||||
|
||||
feature 'As a User I wanna create a dossier' do
|
||||
let(:user) { create(:user) }
|
||||
let(:siret) { '40307130100044' }
|
||||
let(:siren) { siret[0...9] }
|
||||
|
@ -17,18 +16,18 @@ feature 'As a User I wanna create a dossier', js: true do
|
|||
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
page.find_by_id('etape_suivante').trigger('click')
|
||||
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
|
||||
page.find_by_id('etape_suivante').trigger('click')
|
||||
fill_in 'champs_1', with: 'contenu du champ 1'
|
||||
page.find_by_id('suivant').trigger('click')
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: 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), only_path: true)
|
||||
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(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true)
|
||||
end
|
||||
|
||||
scenario 'Identification through siret', vcr: {cassette_name: 'search_ban_paris'} do
|
||||
scenario 'Identification through siret', vcr: {cassette_name: 'search_ban_paris'}, js: true do
|
||||
login_as user, scope: :user
|
||||
visit commencer_path(procedure_path: procedure_with_siret.path)
|
||||
expect(page).to have_current_path(users_dossier_path(Dossier.first.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
||||
fill_in 'dossier_siret', with: siret
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
||||
|
@ -43,11 +42,11 @@ feature 'As a User I wanna create a dossier', js: true do
|
|||
expect(page).to have_css('#recap_info_entreprise')
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
page.find_by_id('etape_suivante').trigger('click')
|
||||
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
||||
page.find_by_id('etape_suivante').trigger('click')
|
||||
fill_in 'champs_1', with: 'contenu du champ 1'
|
||||
fill_in "champs_#{procedure_with_siret.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||
page.find_by_id('suivant').trigger('click')
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ feature 'As a User I want to edit a dossier I own' do
|
|||
fill_in "champs_#{dossier.champs.first.id.to_s}", with: 'Contenu du champ 1'
|
||||
page.find_by_id('modification_terminee').click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s), only_path: true)
|
||||
expect(page.find('#champ-1-value').text).to eq('Contenu du champ 1')
|
||||
expect(page.find("#champ-#{dossier.champs.first.id}-value").text).to eq('Contenu du champ 1')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
|
|||
page.find_by_id('etape_suivante').trigger('click')
|
||||
page.find_by_id('suivant').trigger('click')
|
||||
50.times do
|
||||
Dossier.create(procedure_id: 1, user_id: 1, state: "initiated")
|
||||
Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "initiated")
|
||||
end
|
||||
visit root_path
|
||||
end
|
||||
|
@ -24,30 +24,30 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
|
|||
|
||||
scenario 'Using sort' do
|
||||
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
|
||||
expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('2')
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
|
||||
expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s)
|
||||
visit "/users/dossiers?dossiers_smart_listing[sort][id]=desc"
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('51')
|
||||
expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('50')
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 50).to_s)
|
||||
expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 49).to_s)
|
||||
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
|
||||
expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('2')
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
|
||||
expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s)
|
||||
end
|
||||
|
||||
scenario 'Using pagination' do
|
||||
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
|
||||
page.find('.next_page a').trigger('click')
|
||||
wait_for_ajax
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('11')
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 10).to_s)
|
||||
page.find('.next_page a').trigger('click')
|
||||
wait_for_ajax
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('21')
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 20).to_s)
|
||||
page.find('.prev a').trigger('click')
|
||||
wait_for_ajax
|
||||
page.find('.prev a').trigger('click')
|
||||
wait_for_ajax
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
|
||||
expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id).to_s)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As a User I can send invitations from dossiers', js: true do
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure_1) { create(:procedure, :with_type_de_champ, libelle: 'procedure 1') }
|
||||
|
||||
before 'Assign procedures to Accompagnateur and generating dossiers for each' do
|
||||
Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'initiated')
|
||||
login_as user, scope: :user
|
||||
visit users_dossier_recapitulatif_path(1)
|
||||
end
|
||||
|
||||
context 'On dossier show' do
|
||||
|
||||
scenario 'Sending invitation' do
|
||||
page.find('#invitations').click
|
||||
fill_in 'invitation-email', with: 'toto@email.com'
|
||||
page.find('#send-invitation .btn-success').trigger('click')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -32,8 +32,8 @@ describe TypeDePieceJustificative do
|
|||
end
|
||||
|
||||
context 'lien_demarche' do
|
||||
it { is_expected.not_to allow_value(nil).for(:lien_demarche) }
|
||||
it { is_expected.not_to allow_value('').for(:lien_demarche) }
|
||||
it { is_expected.to allow_value(nil).for(:lien_demarche) }
|
||||
it { is_expected.to allow_value('').for(:lien_demarche) }
|
||||
it { is_expected.not_to allow_value('not-a-link').for(:lien_demarche) }
|
||||
it { is_expected.to allow_value('http://link').for(:lien_demarche) }
|
||||
end
|
||||
|
|
|
@ -269,13 +269,13 @@ describe DossiersListGestionnaireService do
|
|||
|
||||
describe '#change_page!' do
|
||||
let(:procedure) { nil }
|
||||
let(:liste) { 'a_traiter' }
|
||||
let(:liste) { 'all_state' }
|
||||
|
||||
let(:page) { 2 }
|
||||
let(:new_page) { 1 }
|
||||
|
||||
before do
|
||||
preference_smart_listing_page.update page: page, liste: 'a_traiter', procedure: nil
|
||||
preference_smart_listing_page.update page: page, liste: liste, procedure: nil
|
||||
subject
|
||||
preference_smart_listing_page.reload
|
||||
end
|
||||
|
@ -297,7 +297,7 @@ describe DossiersListGestionnaireService do
|
|||
end
|
||||
|
||||
context 'when liste change' do
|
||||
let(:liste) { 'en_attente' }
|
||||
let(:liste) { 'all_state' }
|
||||
|
||||
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||
|
@ -308,7 +308,7 @@ describe DossiersListGestionnaireService do
|
|||
|
||||
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||
it { expect(preference_smart_listing_page.procedure).to eq procedure }
|
||||
it { expect(preference_smart_listing_page.page).to eq 1 }
|
||||
it { expect(preference_smart_listing_page.page).to eq page }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -329,7 +329,7 @@ describe DossiersListGestionnaireService do
|
|||
end
|
||||
|
||||
context 'when procedure and liste change' do
|
||||
let(:liste) { 'en_attente' }
|
||||
let(:liste) { 'all_state' }
|
||||
let(:procedure) { dossier.procedure }
|
||||
|
||||
it { expect(preference_smart_listing_page.liste).to eq liste }
|
||||
|
|
|
@ -8,6 +8,8 @@ describe 'layouts/left_panels/_left_panel_users_dossierscontroller_index.html.ha
|
|||
before do
|
||||
sign_in user
|
||||
|
||||
create :dossier, user: user
|
||||
|
||||
assign :dossiers_list_facade, (DossiersListFacades.new user, param_list)
|
||||
|
||||
render
|
||||
|
|
Loading…
Reference in a new issue