Project

General

Profile

Actions

Bug #19396

closed

Tests failing with "ArgumentError: let 'X' cannot override a method in Minitest::Spec. Please use another name."

Added by Sebastian Gräßl almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
hard
Triaged:
Fixed in Releases:
Found in Releases:

Description

After the recent upgrade of minitest1 test started failing with error like this:

    ArgumentError: let 'image' cannot override a method in Minitest::Spec. Please use another name.
      /usr/local/var/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/minitest-5.10.1/lib/minitest/spec.rb:242:in `let'
    /Users/bastilian/RedHat/Foreman/Repos/foreman/test/models/image_test.rb:20:in `block in <class:ImageTest>'
    /usr/local/var/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/minitest-spec-rails-5.4.0/lib/minitest-spec-rails/dsl.rb:14:in `class_eval'
    /usr/local/var/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/minitest-spec-rails-5.4.0/lib/minitest-spec-rails/dsl.rb:14:in `block in describe'
    /usr/local/var/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/minitest-5.10.1/lib/minitest/spec.rb:83:in `class_eval'
    ...

Before these let() calls did not raise any issue. In this case the method image is not a Minitest::Spec, but a method included from Rake::DSL.
image is not a a method of Rake::DSL either, but a method introduced by the docker-api gem2, which is a dependency of the foreman-docker plugin.

Another case occurred in remote_execution3 and core1 with location and is a legitimate failure as in this case it actually is a `Minitest::Spec` method, the change of organization is presumably just for context.

Right now it is not clear if this was introduced by the latest minitest or if this only surfaced due to the update.
The issue is reproducible only with an updated minitest gem and is not introduced by a change in the same commit.

Clear is that after updating minitest, methods from unrelated sources have been introduced into the test scopes that were not there before.

For now when these warnings happen we can simply change the name and avoid the collision, but we should figure out why this is happening now.
To do so if these errors are encountered verify that they are legitimate. A quick and dirty way is using the following in the test after adjusting the name used in let()*

puts self.method(:METHODNAME).secure_location

If the method definition is nowhere near minitest you can report it here.

[1] https://github.com/theforeman/foreman/commit/edd5310fc97828d306a06ecca861543def61cac8
[2] https://github.com/swipely/docker-api/blob/2b306bad803a2df9a12dab4fc673486365872666/lib/docker/rake_task.rb#L36
[3] https://github.com/theforeman/foreman_remote_execution/pull/243/files#diff-2c6075570be0c5cd68e20ce023b3d550L97


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #19475: Rename test variables to more specific termClosedSebastian Gräßl05/08/2017Actions
Actions

Also available in: Atom PDF