Merge branch 'develop' into staging
This commit is contained in:
commit
b58df269ec
8 changed files with 58 additions and 90 deletions
4
Gemfile
4
Gemfile
|
@ -127,8 +127,8 @@ group :development, :test do
|
||||||
gem 'pry-byebug'
|
gem 'pry-byebug'
|
||||||
|
|
||||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||||
gem 'spring'
|
# gem 'spring'
|
||||||
gem 'spring-commands-rspec'
|
# gem 'spring-commands-rspec'
|
||||||
gem 'rspec-rails', '~> 3.0'
|
gem 'rspec-rails', '~> 3.0'
|
||||||
|
|
||||||
gem 'railroady'
|
gem 'railroady'
|
||||||
|
|
|
@ -551,10 +551,6 @@ GEM
|
||||||
spreadsheet_architect (1.4.8)
|
spreadsheet_architect (1.4.8)
|
||||||
axlsx (>= 2.0)
|
axlsx (>= 2.0)
|
||||||
rodf (= 0.3.7)
|
rodf (= 0.3.7)
|
||||||
spring (2.0.0)
|
|
||||||
activesupport (>= 4.2)
|
|
||||||
spring-commands-rspec (1.0.4)
|
|
||||||
spring (>= 0.9.1)
|
|
||||||
sprockets (3.7.0)
|
sprockets (3.7.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
|
@ -687,8 +683,6 @@ DEPENDENCIES
|
||||||
simplecov
|
simplecov
|
||||||
smart_listing
|
smart_listing
|
||||||
spreadsheet_architect
|
spreadsheet_architect
|
||||||
spring
|
|
||||||
spring-commands-rspec
|
|
||||||
therubyracer
|
therubyracer
|
||||||
timecop
|
timecop
|
||||||
turbolinks (~> 2.5)
|
turbolinks (~> 2.5)
|
||||||
|
|
|
@ -22,11 +22,11 @@ class Users::DescriptionController < UsersController
|
||||||
redirect_to url_for(root_path)
|
redirect_to url_for(root_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def error
|
# def error
|
||||||
show
|
# show
|
||||||
flash.now.alert = 'Un ou plusieurs attributs obligatoires sont manquants ou incorrects.'
|
# flash.now.alert = 'Un ou plusieurs attributs obligatoires sont manquants ou incorrects.'
|
||||||
render 'show'
|
# render 'show'
|
||||||
end
|
# end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@dossier = current_user_dossier
|
@dossier = current_user_dossier
|
||||||
|
|
|
@ -95,14 +95,6 @@ class Dossier < ActiveRecord::Base
|
||||||
commentaires.order(created_at: :desc)
|
commentaires.order(created_at: :desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sous_domaine
|
|
||||||
if Rails.env.production?
|
|
||||||
'tps'
|
|
||||||
else
|
|
||||||
'tps-dev'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def next_step! role, action
|
def next_step! role, action
|
||||||
unless %w(initiate follow update comment valid submit receive refuse without_continuation close).include?(action)
|
unless %w(initiate follow update comment valid submit receive refuse without_continuation close).include?(action)
|
||||||
fail 'action is not valid'
|
fail 'action is not valid'
|
||||||
|
@ -172,58 +164,10 @@ class Dossier < ActiveRecord::Base
|
||||||
state
|
state
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_state?
|
|
||||||
ALL_STATE.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def brouillon?
|
def brouillon?
|
||||||
BROUILLON.include?(state)
|
BROUILLON.include?(state)
|
||||||
end
|
end
|
||||||
|
|
||||||
def nouveaux?
|
|
||||||
NOUVEAUX.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def waiting_for_gestionnaire?
|
|
||||||
WAITING_FOR_GESTIONNAIRE.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def waiting_for_user?
|
|
||||||
WAITING_FOR_USER.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def en_construction?
|
|
||||||
EN_CONSTRUCTION.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def ouvert?
|
|
||||||
OUVERT.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def deposes?
|
|
||||||
DEPOSES.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def valides?
|
|
||||||
VALIDES.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def fige?
|
|
||||||
VALIDES.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def a_instruire?
|
|
||||||
A_INSTRUIRE.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def en_instruction?
|
|
||||||
EN_INSTRUCTION.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def termine?
|
|
||||||
TERMINE.include?(state)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.all_state order = 'ASC'
|
def self.all_state order = 'ASC'
|
||||||
where(state: ALL_STATE, archived: false).order("updated_at #{order}")
|
where(state: ALL_STATE, archived: false).order("updated_at #{order}")
|
||||||
end
|
end
|
||||||
|
@ -362,10 +306,6 @@ class Dossier < ActiveRecord::Base
|
||||||
follows.size
|
follows.size
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_commentaire
|
|
||||||
self.commentaires.size
|
|
||||||
end
|
|
||||||
|
|
||||||
def submit!
|
def submit!
|
||||||
self.deposit_datetime= DateTime.now
|
self.deposit_datetime= DateTime.now
|
||||||
|
|
||||||
|
@ -384,12 +324,4 @@ class Dossier < ActiveRecord::Base
|
||||||
def invite_by_user? email
|
def invite_by_user? email
|
||||||
(invites_user.pluck :email).include? email
|
(invites_user.pluck :email).include? email
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.word_is_an_integer word
|
|
||||||
return 0 if Float(word) > 2147483647
|
|
||||||
|
|
||||||
Float(word)
|
|
||||||
rescue ArgumentError
|
|
||||||
0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
class FranceConnectService
|
class FranceConnectService
|
||||||
def self.retrieve_user_informations_entreprise code
|
|
||||||
client = FranceConnectEntrepriseClient.new code: code
|
|
||||||
|
|
||||||
access_token = client.access_token!(client_auth_method: :secret)
|
|
||||||
user_info = access_token.userinfo!
|
|
||||||
Hashie::Mash.new user_info.raw_attributes
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.retrieve_user_informations_particulier code
|
def self.retrieve_user_informations_particulier code
|
||||||
client = FranceConnectParticulierClient.new code: code
|
client = FranceConnectParticulierClient.new code: code
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ Rails.application.routes.draw do
|
||||||
get '/add_siret' => 'dossiers/add_siret#show'
|
get '/add_siret' => 'dossiers/add_siret#show'
|
||||||
|
|
||||||
get '/description' => 'description#show'
|
get '/description' => 'description#show'
|
||||||
get '/description/error' => 'description#error'
|
# get '/description/error' => 'description#error'
|
||||||
post 'description' => 'description#create'
|
post 'description' => 'description#create'
|
||||||
|
|
||||||
patch 'pieces_justificatives' => 'description#pieces_justificatives'
|
patch 'pieces_justificatives' => 'description#pieces_justificatives'
|
||||||
|
|
|
@ -27,6 +27,8 @@ shared_examples 'description_controller_spec' do
|
||||||
|
|
||||||
it 'redirection vers start si mauvais dossier ID' do
|
it 'redirection vers start si mauvais dossier ID' do
|
||||||
get :show, params: {dossier_id: bad_dossier_id}
|
get :show, params: {dossier_id: bad_dossier_id}
|
||||||
|
|
||||||
|
expect(flash[:alert]).to be_present
|
||||||
expect(response).to redirect_to(root_path)
|
expect(response).to redirect_to(root_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
48
spec/lib/file_size_validator_spec.rb
Normal file
48
spec/lib/file_size_validator_spec.rb
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FileSizeValidator, lib: true do
|
||||||
|
let(:validator) { FileSizeValidator.new(options) }
|
||||||
|
let(:attachment) { CerfaUploader.new }
|
||||||
|
let(:note) { create(:cerfa) }
|
||||||
|
|
||||||
|
describe 'options uses an integer' do
|
||||||
|
let(:options) { { maximum: 10, attributes: { content: attachment } } }
|
||||||
|
|
||||||
|
it 'attachment exceeds maximum limit' do
|
||||||
|
allow(attachment).to receive(:size) { 100 }
|
||||||
|
validator.validate_each(note, :content, attachment)
|
||||||
|
expect(note.errors).to have_key(:content)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'attachment under maximum limit' do
|
||||||
|
allow(attachment).to receive(:size) { 1 }
|
||||||
|
validator.validate_each(note, :content, attachment)
|
||||||
|
expect(note.errors).not_to have_key(:content)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'options uses a symbol' do
|
||||||
|
let(:options) do
|
||||||
|
{
|
||||||
|
maximum: :test,
|
||||||
|
attributes: { content: attachment }
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(note).to receive(:test) { 10 }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'attachment exceeds maximum limit' do
|
||||||
|
allow(attachment).to receive(:size) { 100 }
|
||||||
|
validator.validate_each(note, :content, attachment)
|
||||||
|
expect(note.errors).to have_key(:content)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'attachment under maximum limit' do
|
||||||
|
allow(attachment).to receive(:size) { 1 }
|
||||||
|
validator.validate_each(note, :content, attachment)
|
||||||
|
expect(note.errors).not_to have_key(:content)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue