make label method name more explict

This commit is contained in:
Christophe Robillard 2022-09-26 15:53:28 +02:00
parent f846393ec0
commit ddd5f6ece2
3 changed files with 3 additions and 3 deletions

View file

@ -48,6 +48,6 @@ class ZoneDashboard < Administrate::BaseDashboard
# across all pages of the admin dashboard.
#
def display_resource(zone)
"Zone #{zone.label}"
"Zone #{zone.current_label}"
end
end

View file

@ -13,7 +13,7 @@ class Zone < ApplicationRecord
has_many :labels, -> { order(designated_on: :desc) }, class_name: 'ZoneLabel', inverse_of: :zone
has_many :procedures, -> { order(published_at: :desc) }, inverse_of: :zone
def label
def current_label
labels.first.name
end

View file

@ -25,7 +25,7 @@ describe Zone do
end
it 'returns label for the current millesime' do
expect(zone.label).to eq "Ministère de l'Économie, des Finances et de la Souveraineté industrielle et numérique"
expect(zone.current_label).to eq "Ministère de l'Économie, des Finances et de la Souveraineté industrielle et numérique"
end
it 'returns label at specific date' do