fix(manager/services): d'ont search in etablissement_adresse (this is not a schema field)

This commit is contained in:
Colin Darie 2022-09-05 12:31:32 +02:00
parent 23fbc9210e
commit 3c9b41e233
2 changed files with 32 additions and 1 deletions

View file

@ -20,7 +20,7 @@ class ServiceDashboard < Administrate::BaseDashboard
horaires: Field::String, horaires: Field::String,
adresse: Field::String, adresse: Field::String,
siret: Field::String, siret: Field::String,
etablissement_adresse: Field::String, etablissement_adresse: Field::String.with_options(searchable: false),
etablissement_latlng: GeopointField etablissement_latlng: GeopointField
}.freeze }.freeze

View file

@ -0,0 +1,31 @@
describe Manager::ServicesController, type: :controller do
let(:super_admin) { create(:super_admin) }
before do
sign_in super_admin
@service = create(:service)
end
render_views
describe 'GET #index' do
it "should list services" do
get :index
expect(response.body).to include(@service.nom)
end
it "should search by nom" do
get :index, params: { search: @service.nom.first(3) }
expect(response.body).to include(@service.nom)
end
end
describe "GET #show" do
before do
get :show, params: { id: @service.id }
end
it { expect(response.body).to include(@service.nom) }
it { expect(response.body).to include("75 rue du Louvre") }
it { expect(response.body).to have_link(href: "https://www.geoportail.gouv.fr/carte?c=2.34,48.87&z=17&permalink=yes") }
end
end