gtt-project / redmine_custom_fields_groups

Redmine plugin for grouping custom fields.
GNU General Public License v3.0
12 stars 4 forks source link

Automatic Weblate translation PR CI unit test is failing #31

Closed sanak closed 3 months ago

sanak commented 3 months ago

Problem Currently, automatic Weblate translation PR CI is failing. Jobs: https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703

https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718463297#step:7:1

Error:
CustomFieldsGroupTest#test_should_require_name:
NoMethodError: undefined method `deep_symbolize_keys' for #<String:0x000055a13a4071e0>
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:22:in `block in <class:CustomFieldsGroupTest>'

bin/rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:20
:
Error:
CustomFieldsGroupTest#test_should_validate_name_uniqueness:
NoMethodError: undefined method `deep_symbolize_keys' for #<String:0x000055a13c831f70>
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:37:in `block (2 levels) in <class:CustomFieldsGroupTest>'
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:[34](https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718463297#step:7:35):in `block in <class:CustomFieldsGroupTest>'

bin/rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:26

https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718467637#step:7:1

Error:
CustomFieldsGroupTest#test_should_require_name:
TypeError: no implicit conversion of String into Hash
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:2[3](https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718467637#step:7:3):in `block in <class:CustomFieldsGroupTest>'

rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:20
:
Error:
CustomFieldsGroupTest#test_should_validate_name_uniqueness:
TypeError: no implicit conversion of String into Hash
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:38:in `block (2 levels) in <class:CustomFieldsGroupTest>'
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:3[4](https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718467637#step:7:4):in `block in <class:CustomFieldsGroupTest>'

rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:26

To Reproduce I am not sure why this unit test error is happen, but the errors happen same place, and I guess that custom_fields_group.errors[:name] causes the errors. https://github.com/gtt-project/redmine_custom_fields_groups/blob/next/test/unit/custom_fields_group_test.rb#L20-L40

  test 'should require name' do
    custom_fields_group = CustomFieldsGroup.new
    assert_not custom_fields_group.save
    assert custom_fields_group.errors[:name]
  end

  test 'should validate name uniqueness' do
    assert_difference 'CustomFieldsGroup.count' do
      custom_fields_group = CustomFieldsGroup.new
      custom_fields_group.name = 'test'
      assert custom_fields_group.save
      assert_equal 'test', custom_fields_group.name
    end

    assert_no_difference 'CustomFieldsGroup.count' do
      custom_fields_group = CustomFieldsGroup.new
      custom_fields_group.name = 'test'
      assert_not custom_fields_group.save
      assert custom_fields_group.errors[:name]
    end
  end

Expectation The errors should not happen from any repository PR.

sanak commented 3 months ago

Above errors happen on next branch, so I will try to fix it. https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9359189913

sanak commented 3 months ago

Close this, because fix PR was merged.