Adapt search function at the PreferenceListDossier table

This commit is contained in:
Xavier J 2016-10-07 14:58:45 +02:00
parent 7c2bcd0b64
commit ac971a805e
9 changed files with 37 additions and 81 deletions

View file

@ -24,7 +24,7 @@ feature 'search file on gestionnaire backoffice' do
it { expect(page).to have_css('#backoffice_search') }
context 'when terms input is empty' do
it { expect(page).to have_content('Aucun dossier trouvé') }
it { expect(page).to have_content('Aucun dossier') }
end
context 'when terms input is informed' do
@ -35,7 +35,7 @@ feature 'search file on gestionnaire backoffice' do
end
context 'when terms input does not return result' do
it { expect(page).to have_content('Aucun dossier trouvé') }
it { expect(page).to have_content('Aucun dossier') }
end
context 'when terms input does return result' do
@ -45,12 +45,6 @@ feature 'search file on gestionnaire backoffice' do
let(:terms) { dossier.entreprise.raison_sociale }
it { expect(page).to have_content(dossier.entreprise.raison_sociale) }
context "when terms is a file's id" do
let(:terms) { dossier.id }
it { expect(page).to have_content("Dossier N°#{dossier.id}") }
end
end
end
end

View file

@ -559,8 +559,8 @@ describe Dossier do
describe '.search' do
subject { liste_dossiers }
let(:liste_dossiers) { described_class.search(gestionnaire_1, terms)[0] }
let(:dossier) { described_class.search(gestionnaire_1, terms)[1] }
let(:liste_dossiers) { described_class.search(gestionnaire_1, terms) }
# let(:dossier) { described_class.search(gestionnaire_1, terms)[1] }
let(:administrateur_1) { create(:administrateur) }
let(:administrateur_2) { create(:administrateur) }
@ -596,6 +596,7 @@ describe Dossier do
let(:terms) { 'brouillon' }
it { expect(subject.size).to eq(0) }
it { expect(subject.class).to eq Dossier::ActiveRecord_Relation }
end
describe 'search on contact email' do
@ -607,7 +608,7 @@ describe Dossier do
describe 'search on ID dossier' do
let(:terms) { "#{dossier_2.id}" }
it { expect(dossier.id).to eq(dossier_2.id) }
it { expect(subject.size).to eq(1) }
end
describe 'search on SIRET' do

View file

@ -60,6 +60,7 @@ end
DatabaseCleaner.strategy = :truncation
SIADETOKEN = :valid_token unless defined? SIADETOKEN
BROWSER.value = Browser.new('Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)')
include Warden::Test::Helpers