correction home page bad siret error
This commit is contained in:
parent
3898d8f88e
commit
f7fb0f99bf
4 changed files with 15 additions and 8 deletions
|
@ -27,7 +27,7 @@ class DossiersController < ApplicationController
|
||||||
redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
|
redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
|
||||||
|
|
||||||
rescue RestClient::ResourceNotFound
|
rescue RestClient::ResourceNotFound
|
||||||
redirect_to url_for(controller: :start, action: :error_siret)
|
redirect_to url_for(controller: :start, action: :error_siret, procedure_id: params['procedure_id'])
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
redirect_to url_for(controller: :start, action: :error_dossier)
|
redirect_to url_for(controller: :start, action: :error_dossier)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class StartController < ApplicationController
|
class StartController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@procedure_id = params['procedure_id']
|
get_procedure_infos
|
||||||
@procedure = Procedure.find(@procedure_id)
|
|
||||||
|
|
||||||
if @procedure.nil?
|
if @procedure.nil?
|
||||||
error_procedure
|
error_procedure
|
||||||
|
@ -15,6 +14,7 @@ class StartController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def error_siret
|
def error_siret
|
||||||
|
get_procedure_infos
|
||||||
flash.now.alert = 'Ce SIRET n\'est pas valide'
|
flash.now.alert = 'Ce SIRET n\'est pas valide'
|
||||||
render 'index'
|
render 'index'
|
||||||
end
|
end
|
||||||
|
@ -28,4 +28,10 @@ class StartController < ApplicationController
|
||||||
flash.now.alert = 'Ce dossier n\'existe pas'
|
flash.now.alert = 'Ce dossier n\'existe pas'
|
||||||
render 'index'
|
render 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def get_procedure_infos
|
||||||
|
@procedure = Procedure.find(params['procedure_id'])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,8 +45,8 @@ ActiveRecord::Schema.define(version: 20150922113504) do
|
||||||
t.boolean "dossier_termine"
|
t.boolean "dossier_termine"
|
||||||
t.integer "procedure_id"
|
t.integer "procedure_id"
|
||||||
t.date "date_previsionnelle"
|
t.date "date_previsionnelle"
|
||||||
t.datetime "created_at", default: '2015-09-22 09:25:29'
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at", default: '2015-09-22 09:25:29'
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
|
add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
|
||||||
|
@ -108,7 +108,7 @@ ActiveRecord::Schema.define(version: 20150922113504) do
|
||||||
t.integer "type_de_piece_justificative_id"
|
t.integer "type_de_piece_justificative_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
|
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_piece_jointe_id", using: :btree
|
||||||
|
|
||||||
create_table "procedures", force: :cascade do |t|
|
create_table "procedures", force: :cascade do |t|
|
||||||
t.string "libelle"
|
t.string "libelle"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe StartController, type: :controller do
|
RSpec.describe StartController, type: :controller do
|
||||||
|
let!(:procedure) { create(:procedure) }
|
||||||
|
|
||||||
describe 'GET #index' do
|
describe 'GET #index' do
|
||||||
let!(:procedure) { create(:procedure) }
|
|
||||||
before do
|
before do
|
||||||
get :index, procedure_id: procedure
|
get :index, procedure_id: procedure
|
||||||
end
|
end
|
||||||
|
@ -28,7 +29,7 @@ RSpec.describe StartController, type: :controller do
|
||||||
|
|
||||||
describe 'GET #index with bad SIRET' do
|
describe 'GET #index with bad SIRET' do
|
||||||
before do
|
before do
|
||||||
get :error_siret
|
get :error_siret, procedure_id: procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success and flash alert is present' do
|
it 'returns http success and flash alert is present' do
|
||||||
|
|
Loading…
Reference in a new issue