Merge branch 'develop' of ssh://37.187.249.111:2200/opt/git/tps into develop

This commit is contained in:
Xavier J 2015-09-22 13:16:09 +02:00
commit 017c90f7b6
12 changed files with 40 additions and 15 deletions

View file

@ -68,6 +68,7 @@ group :test do
gem 'shoulda-matchers', require: false
gem 'simplecov', require: false
gem 'poltergeist'
gem 'timecop'
end
group :development, :test do

View file

@ -292,6 +292,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
timecop (0.7.3)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
@ -365,6 +366,7 @@ DEPENDENCIES
simplecov
spring
spring-commands-rspec
timecop
turbolinks
uglifier (>= 1.3.0)
unicorn

View file

@ -2,6 +2,6 @@ class BackofficeController < ApplicationController
def index
redirect_to(controller: '/gestionnaires/sessions', action: :new) unless gestionnaire_signed_in?
@dossiers = Dossier.all.decorate
end
end

View file

@ -6,4 +6,8 @@ class DossierDecorator < Draper::Decorator
rescue
'dd/mm/YYYY'
end
def last_update
updated_at.localtime.strftime('%d/%m/%Y %H:%M')
end
end

View file

@ -7,8 +7,9 @@
%th Dossier
%th etat
%th Date de mise à jour
%row
%td Demande de subventions
%td dossier n°34 Demande de subvention
%td Mise à jour
%td 24/12/2015
- @dossiers.each do |dossier|
%tr
%td= dossier.procedure.libelle
%td= dossier.nom_projet
%td Mise à jour
%td= dossier.last_update

View file

@ -78,3 +78,5 @@ fr:
not_saved:
one: "1 erreur a empêché ce(tte) %{resource} d'être sauvegardé(e) :"
other: "%{count} erreurs ont empêché ce(tte) %{resource} d'être sauvegardé(e) :"

View file

@ -1,6 +1,6 @@
class AddTimeStampToDossier < ActiveRecord::Migration
def change
add_column :dossiers, :created_at, :datetime
add_column :dossiers, :updated_at, :datetime
add_column :dossiers, :created_at, :datetime, default: Time.now
add_column :dossiers, :updated_at, :datetime, default: Time.now
end
end

View file

@ -47,8 +47,8 @@ ActiveRecord::Schema.define(version: 20150922110719) do
t.boolean "dossier_termine"
t.integer "procedure_id"
t.date "date_previsionnelle"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", default: '2015-09-22 09:25:29'
t.datetime "updated_at", default: '2015-09-22 09:25:29'
end
add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree

View file

@ -1,4 +1,10 @@
require 'spec_helper'
describe DossierDecorator do
let(:dossier) { create(:dossier) }
subject { dossier.decorate }
describe 'last_update' do
subject { Timecop.freeze(Time.new(2015, 12, 24, 14, 10)) { super().last_update } }
it { is_expected.to eq('24/12/2015 14:10') }
end
end

View file

@ -1,8 +1,8 @@
FactoryGirl.define do
factory :procedure do
libelle 'Demande de subvention'
description 'Description demande de subvention'
lien_demarche 'http://localhost'
libelle 'Demande de subvention'
description "Demande de subvention à l'intention des associations"
trait :with_two_type_de_piece_justificative do
after(:build) do |procedure, _evaluator|

View file

@ -1,6 +1,8 @@
require 'spec_helper'
feature 'when gestionnaire come to /backoffice and is not authenticated' do
let(:procedure) { create(:procedure) }
let!(:dossier) { create(:dossier, procedure: procedure) }
before do
visit backoffice_path
end

View file

@ -1,9 +1,16 @@
require 'spec_helper'
describe 'backoffice/index.html.haml', type: :view do
let!(:procedure) { create(:procedure) }
let!(:decorated_dossier) { create(:dossier, procedure: procedure).decorate }
before do
assign(:dossiers, [decorated_dossier])
render
end
it { expect(rendered).to have_css('#backoffice') }
subject { rendered }
it { is_expected.to have_css('#backoffice') }
it { is_expected.to have_content('Demande de subvention') }
it { is_expected.to have_content(procedure.libelle) }
it { is_expected.to have_content(decorated_dossier.nom_projet) }
it { is_expected.to have_content(decorated_dossier.last_update) }
end