Refactor dossier decorators
This commit is contained in:
parent
9fb575ef8c
commit
39b15e8b3d
13 changed files with 37 additions and 59 deletions
|
@ -10,7 +10,7 @@ describe DossierDecorator do
|
|||
end
|
||||
|
||||
describe 'state_fr' do
|
||||
subject{ super().state_fr }
|
||||
subject{ super().display_state }
|
||||
|
||||
it 'draft is brouillon' do
|
||||
dossier.draft!
|
||||
|
|
|
@ -109,9 +109,7 @@ describe SIADE::API do
|
|||
let(:status) { 200 }
|
||||
let(:body) { File.read('spec/support/files/rna.json') }
|
||||
|
||||
it 'raises RestClient::Unauthorized' do
|
||||
expect(subject).to eq(body)
|
||||
end
|
||||
it{ expect(subject).to eq(body) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ describe SIADE::RNAAdapter do
|
|||
let(:siret) { '50480511000013' }
|
||||
let(:body) { File.read('spec/support/files/rna.json') }
|
||||
let(:status) { 200 }
|
||||
|
||||
subject { described_class.new(siret).to_params }
|
||||
|
||||
before do
|
||||
|
@ -15,36 +16,23 @@ describe SIADE::RNAAdapter do
|
|||
let(:siret) { '234567' }
|
||||
let(:body) { '' }
|
||||
let(:status) { '404' }
|
||||
|
||||
it { is_expected.to eq(nil) }
|
||||
end
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
expect(subject).to be_an_instance_of(Hash)
|
||||
end
|
||||
it { expect(subject).to be_an_instance_of(Hash) }
|
||||
|
||||
context 'Attributs Associations' do
|
||||
it 'L\'associations contient bien un id' do
|
||||
expect(subject[:association_id]).to eq('W595001988')
|
||||
end
|
||||
describe 'Attributs Associations' do
|
||||
it { expect(subject[:association_id]).to eq('W595001988') }
|
||||
|
||||
it 'L\'associations contient bien un titre' do
|
||||
expect(subject[:titre]).to eq('UN SUR QUATRE')
|
||||
end
|
||||
it { expect(subject[:titre]).to eq('UN SUR QUATRE') }
|
||||
|
||||
it 'L\'associations contient bien un objet' do
|
||||
expect(subject[:objet]).to eq("valoriser, transmettre et partager auprès des publics les plus larges possibles, les bienfaits de l'immigration, la richesse de la diversité et la curiosité de l'autre autrement")
|
||||
end
|
||||
it { expect(subject[:objet]).to eq("valoriser, transmettre et partager auprès des publics les plus larges possibles, les bienfaits de l'immigration, la richesse de la diversité et la curiosité de l'autre autrement") }
|
||||
|
||||
it 'L\'associations contient bien une date de creation' do
|
||||
expect(subject[:date_creation]).to eq('2014-01-23')
|
||||
end
|
||||
it { expect(subject[:date_creation]).to eq('2014-01-23') }
|
||||
|
||||
it 'L\'associations contient bien une date de de declaration' do
|
||||
expect(subject[:date_declaration]).to eq('2014-01-24')
|
||||
end
|
||||
it { expect(subject[:date_declaration]).to eq('2014-01-24') }
|
||||
|
||||
it 'L\'associations contient bien une date de publication' do
|
||||
expect(subject[:date_publication]).to eq('2014-02-08')
|
||||
end
|
||||
it { expect(subject[:date_publication]).to eq('2014-02-08') }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
it { is_expected.to have_css('#backoffice_index') }
|
||||
it { is_expected.to have_content(procedure.libelle) }
|
||||
it { is_expected.to have_content(decorate_dossier_initiated.nom_projet) }
|
||||
it { is_expected.to have_content(decorate_dossier_initiated.state_fr) }
|
||||
it { is_expected.to have_content(decorate_dossier_initiated.display_state) }
|
||||
it { is_expected.to have_content(decorate_dossier_initiated.last_update) }
|
||||
|
||||
it { is_expected.not_to have_content(decorate_dossier_replied.nom_projet) }
|
||||
|
@ -47,7 +47,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
it { is_expected.to have_css('#backoffice_index') }
|
||||
it { is_expected.to have_content(procedure.libelle) }
|
||||
it { is_expected.to have_content(decorate_dossier_replied.nom_projet) }
|
||||
it { is_expected.to have_content(decorate_dossier_replied.state_fr) }
|
||||
it { is_expected.to have_content(decorate_dossier_replied.display_state) }
|
||||
it { is_expected.to have_content(decorate_dossier_replied.last_update) }
|
||||
|
||||
it { is_expected.not_to have_content(decorate_dossier_initiated.nom_projet) }
|
||||
|
@ -70,7 +70,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
it { is_expected.to have_css('#backoffice_index') }
|
||||
it { is_expected.to have_content(procedure.libelle) }
|
||||
it { is_expected.to have_content(decorate_dossier_closed.nom_projet) }
|
||||
it { is_expected.to have_content(decorate_dossier_closed.state_fr) }
|
||||
it { is_expected.to have_content(decorate_dossier_closed.display_state) }
|
||||
it { is_expected.to have_content(decorate_dossier_closed.last_update) }
|
||||
|
||||
it { is_expected.not_to have_content(decorate_dossier_initiated.nom_projet) }
|
||||
|
|
|
@ -25,7 +25,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
describe 'dossier replied is present' do
|
||||
it { is_expected.to have_content(dossier_2.procedure.libelle) }
|
||||
it { is_expected.to have_content(dossier_2.nom_projet) }
|
||||
it { is_expected.to have_content(dossier_2.state_fr) }
|
||||
it { is_expected.to have_content(dossier_2.display_state) }
|
||||
it { is_expected.to have_content(dossier_2.last_update) }
|
||||
end
|
||||
|
||||
|
@ -53,7 +53,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
describe 'dossier initiated is present' do
|
||||
it { is_expected.to have_content(dossier.procedure.libelle) }
|
||||
it { is_expected.to have_content(dossier.nom_projet) }
|
||||
it { is_expected.to have_content(dossier.state_fr) }
|
||||
it { is_expected.to have_content(dossier.display_state) }
|
||||
it { is_expected.to have_content(dossier.last_update) }
|
||||
end
|
||||
|
||||
|
@ -81,7 +81,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
describe 'dossier termine is present' do
|
||||
it { is_expected.to have_content(dossier_termine.procedure.libelle) }
|
||||
it { is_expected.to have_content(dossier_termine.nom_projet) }
|
||||
it { is_expected.to have_content(dossier_termine.state_fr) }
|
||||
it { is_expected.to have_content(dossier_termine.display_state) }
|
||||
it { is_expected.to have_content(dossier_termine.last_update) }
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue