Don’t rely on a decorator for ProcedureSerializer#geographic_information

This commit is contained in:
Paul Chavard 2018-10-22 19:24:38 +02:00
parent 2e7a4a4098
commit 53a261f424
4 changed files with 5 additions and 12 deletions

View file

@ -2,7 +2,7 @@ class API::V1::ProceduresController < APIController
before_action :fetch_procedure_and_check_token
def show
render json: { procedure: ProcedureSerializer.new(@procedure.decorate).as_json }
render json: { procedure: ProcedureSerializer.new(@procedure).as_json }
end
private

View file

@ -22,8 +22,4 @@ class ProcedureDecorator < Draper::Decorator
end
end
end
def geographic_information
module_api_carto
end
end

View file

@ -31,4 +31,8 @@ class ProcedureSerializer < ActiveModel::Serializer
def state
object.aasm_state
end
def geographic_information
object.module_api_carto
end
end

View file

@ -26,11 +26,4 @@ describe ProcedureDecorator do
subject { super().logo_img }
it { is_expected.to match(/http.*#{ActionController::Base.helpers.image_url("marianne.svg")}/) }
end
describe 'geographic_information' do
subject { super().geographic_information }
it { expect(subject.use_api_carto).to be_falsey }
it { expect(subject.quartiers_prioritaires).to be_falsey }
it { expect(subject.cadastre).to be_falsey }
end
end