OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix tabular form builder specs, also scope the localized label inference to the form's object name.
Dombi Attila72c0b93eb772
diff --git a/lib/tabular_form_builder.rb b/lib/tabular_form_builder.rbindex 3e5e2d4d6a8..e7f92f79b2c 100644--- a/lib/tabular_form_builder.rb+++ b/lib/tabular_form_builder.rb@@ -332,7 +332,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilderelsif @object.class.respond_to?(:human_attribute_name)@object.class.human_attribute_name(field)else- I18n.t(field)+ I18n.t(field, scope: sanitized_object_name)endenddiff --git a/spec/lib/tabular_form_builder_spec.rb b/spec/lib/tabular_form_builder_spec.rbindex 991d11e437f..46c5921c065 100644--- a/spec/lib/tabular_form_builder_spec.rb+++ b/spec/lib/tabular_form_builder_spec.rb@@ -614,7 +614,7 @@ JJ Abrams</textarea>endcontext 'with a label specified as symbol' do- let(:text) { :name }+ let(:text) { :label_name }before dooptions[:label] = text@@ -626,10 +626,16 @@ JJ Abrams</textarea>endcontext 'without ActiveModel and specified label' do+ # This is a hypotethical resource that does not have an existing translation+ # key, therefore stubbing the translation is allowed.+ before do+ allow(I18n).to receive(:t).with(:name, scope: 'user').and_return('Name')+ end+let(:resource) { OpenStruct.new name: 'Deadpool' }it 'falls back to the I18n name' do- expected_label_like(I18n.t(:name))+ expected_label_like(I18n.t(:name, scope: 'user'))endend@@ -669,7 +675,7 @@ JJ Abrams</textarea>endcontext 'when required, with a label specified as symbol' do- let(:text) { :name }+ let(:text) { :label_name }before dooptions[:label] = text@@ -677,7 +683,7 @@ JJ Abrams</textarea>endit 'uses the label' do- expected_form_label_like(I18n.t(:name), 'form--label')+ expected_form_label_like(I18n.t(:label_name), 'form--label')endendend