Merge branch 'develop' into staging
This commit is contained in:
commit
364a97b127
10 changed files with 206 additions and 173 deletions
63
.circleci/config.yml
Normal file
63
.circleci/config.yml
Normal file
|
@ -0,0 +1,63 @@
|
|||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: ruby:2.3.1
|
||||
- image: postgres:9.4.1
|
||||
environment:
|
||||
POSTGRES_USER: tps_test
|
||||
POSTGRES_PASSWORD: tps_test
|
||||
POSTGRES_DB: tps_test
|
||||
|
||||
working_directory: /tps
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install System Dependencies
|
||||
command: apt-get update -qq && apt-get install -y build-essential nodejs
|
||||
- restore_cache:
|
||||
key: bundle-install-v3-{{ checksum "Gemfile.lock" }}
|
||||
- run:
|
||||
name: Install Ruby Dependencies
|
||||
command: bundle install
|
||||
- save_cache:
|
||||
key: bundle-install-v3-{{ checksum "Gemfile.lock" }}
|
||||
paths:
|
||||
- /usr/local/bundle
|
||||
- restore_cache:
|
||||
key: phantomjs-2-1-1
|
||||
- run:
|
||||
name: Install PhantomJS Dependencies
|
||||
command: |
|
||||
[ -f /usr/local/bin/phantomjs ] || apt-get update
|
||||
[ -f /usr/local/bin/phantomjs ] || apt-get install -y fontconfig wget
|
||||
- run:
|
||||
name: Install PhantomJS
|
||||
command: |
|
||||
[ -f /usr/local/bin/phantomjs ] || wget -O /tmp/phantomjs.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
|
||||
[ -f /usr/local/bin/phantomjs ] || tar -xjf /tmp/phantomjs.tar.bz2 -C /tmp
|
||||
[ -f /usr/local/bin/phantomjs ] || mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
|
||||
- save_cache:
|
||||
key: phantomjs-2-1-1
|
||||
paths:
|
||||
- /usr/local/bin/phantomjs
|
||||
- run:
|
||||
environment:
|
||||
DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test"
|
||||
name: Create DB
|
||||
command: bundle exec rake db:create db:schema:load db:migrate RAILS_ENV=test
|
||||
- run:
|
||||
environment:
|
||||
DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test"
|
||||
name: Run Tests, Splitted by Timings
|
||||
command: |
|
||||
TESTFILES=$(circleci tests glob "spec/**/*.rb"| xargs -n 1 echo | grep -v "spec/factories/" | tr " " "\n" | circleci tests split --split-by=timings)
|
||||
bundle exec rspec --color --require spec_helper -- ${TESTFILES}
|
||||
- run:
|
||||
name: Run haml-lint
|
||||
command: bundle exec haml-lint app/views/
|
||||
- deploy:
|
||||
command: |
|
||||
if [ "${CIRCLE_BRANCH}" == "staging" ]; then
|
||||
bundle exec rake deploy_ha
|
||||
fi
|
|
@ -134,9 +134,7 @@ class Procedure < ActiveRecord::Base
|
|||
exportable_dossiers = dossiers.downloadable
|
||||
|
||||
headers = exportable_dossiers.any? ? exportable_dossiers.first.export_headers : []
|
||||
data = exportable_dossiers.map do |dossier|
|
||||
dossier.full_data_strings_array
|
||||
end
|
||||
data = exportable_dossiers.any? ? exportable_dossiers.map { |d| d.full_data_strings_array } : [[]]
|
||||
|
||||
{
|
||||
headers: headers,
|
||||
|
|
15
circle.yml
15
circle.yml
|
@ -1,15 +0,0 @@
|
|||
database:
|
||||
override:
|
||||
- cp config/database.yml.ci config/database.yml
|
||||
- bundle exec rake db:create db:schema:load db:migrate RAILS_ENV=test
|
||||
|
||||
test:
|
||||
override:
|
||||
- bundle exec rspec
|
||||
- bundle exec haml-lint app/views/
|
||||
|
||||
deployment:
|
||||
staging:
|
||||
branch: staging
|
||||
commands:
|
||||
- bundle exec rake deploy_ha
|
|
@ -1,6 +0,0 @@
|
|||
test:
|
||||
adapter: postgresql
|
||||
database: app_test
|
||||
pool: 5
|
||||
username:
|
||||
password:
|
|
@ -24,7 +24,7 @@ describe API::V1::DossiersController do
|
|||
|
||||
context 'when procedure is found and belongs to admin' do
|
||||
let(:procedure_id) { procedure.id }
|
||||
let(:date_creation) { Time.local(2008, 9, 1, 10, 5, 0) }
|
||||
let(:date_creation) { Time.utc(2008, 9, 1, 10, 5, 0) }
|
||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') } }
|
||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||
|
||||
|
@ -52,9 +52,7 @@ describe API::V1::DossiersController do
|
|||
describe 'dossier' do
|
||||
subject { super().first }
|
||||
it { expect(subject[:id]).to eq(dossier.id) }
|
||||
if ENV['PG'] == 'true'
|
||||
it { expect(subject[:updated_at]).to eq("2008-09-01T08:05:00.000Z") }
|
||||
end
|
||||
it { expect(subject[:updated_at]).to eq("2008-09-01T10:05:00.000Z") }
|
||||
it { expect(subject.keys.size).to eq(2) }
|
||||
end
|
||||
end
|
||||
|
@ -113,7 +111,7 @@ describe API::V1::DossiersController do
|
|||
|
||||
context 'when dossier exists and belongs to procedure' do
|
||||
let(:procedure_id) { procedure.id }
|
||||
let(:date_creation) { Time.local(2008, 9, 1, 10, 5, 0) }
|
||||
let(:date_creation) { Time.utc(2008, 9, 1, 10, 5, 0) }
|
||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||
|
@ -126,10 +124,8 @@ describe API::V1::DossiersController do
|
|||
|
||||
it { expect(subject[:id]).to eq(dossier.id) }
|
||||
it { expect(subject[:state]).to eq(dossier.state) }
|
||||
if ENV['PG'] == 'true'
|
||||
it { expect(subject[:created_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
end
|
||||
it { expect(subject[:created_at]).to eq('2008-09-01T10:05:00.000Z') }
|
||||
it { expect(subject[:updated_at]).to eq('2008-09-01T10:05:00.000Z') }
|
||||
it { expect(subject[:archived]).to eq(dossier.archived) }
|
||||
it { expect(subject[:mandataire_social]).to eq(dossier.mandataire_social) }
|
||||
|
||||
|
|
|
@ -169,7 +169,6 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
|
||||
if ENV['PG'] == 'true'
|
||||
describe 'POST #search' do
|
||||
describe 'by id' do
|
||||
context 'when I am logged as a gestionnaire' do
|
||||
|
@ -208,7 +207,6 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #receive' do
|
||||
before do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe CommentaireDecorator do
|
||||
let(:commentaire) { Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0)) {create :commentaire} }
|
||||
let(:commentaire) { Timecop.freeze(Time.utc(2008, 9, 1, 10, 5, 0)) {create :commentaire} }
|
||||
let(:decorator) { commentaire.decorate }
|
||||
|
||||
describe 'created_at_fr' do
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
if ENV['PG'] == 'true'
|
||||
feature 'search file on gestionnaire backoffice' do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
|
||||
|
@ -51,4 +50,3 @@ if ENV['PG'] == 'true'
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -261,11 +261,15 @@ describe Procedure do
|
|||
let(:procedure) { create :procedure }
|
||||
subject { procedure.generate_export }
|
||||
|
||||
context 'when there are no dossiers' do
|
||||
it { expect(subject[:data]).to eq([]) }
|
||||
shared_examples "export is empty" do
|
||||
it { expect(subject[:data]).to eq([[]]) }
|
||||
it { expect(subject[:headers]).to eq([]) }
|
||||
end
|
||||
|
||||
context 'when there are no dossiers' do
|
||||
it_behaves_like "export is empty"
|
||||
end
|
||||
|
||||
context 'when there are some dossiers' do
|
||||
let!(:dossier){ create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier2){ create(:dossier, procedure: procedure, state: 'closed') }
|
||||
|
@ -277,8 +281,7 @@ describe Procedure do
|
|||
context 'when there is a draft dossier' do
|
||||
let!(:dossier_not_exportable){ create(:dossier, procedure: procedure, state: 'draft') }
|
||||
|
||||
it { expect(subject[:data]).to eq([]) }
|
||||
it { expect(subject[:headers]).to eq([]) }
|
||||
it_behaves_like "export is empty"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
if ENV['PG'] == 'true'
|
||||
describe Search do
|
||||
describe '.results' do
|
||||
subject { liste_dossiers }
|
||||
|
@ -78,4 +77,3 @@ if ENV['PG'] == 'true'
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue