Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved specs during Gem::Specification.reset: minitest (~> 5.1) #1267

Closed
shawndeprey opened this Issue May 28, 2015 · 15 comments

Comments

@shawndeprey
Copy link

shawndeprey commented May 28, 2015

I wasn't sure where to put this, but I saw a similar issue here(#1070) being discussed and figured it was the right place.

I am running into the following issue:

$ rake test:prepare
WARN: Unresolved specs during Gem::Specification.reset:
      minitest (~> 5.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.

Normally this warning doesn't block the command from running like in the above output, but the warning does show on almost all commands I run which load my environment. I have tried quite a few different fixes to this issue. I have tried using minitest 5.1. Uninstalling/installing my bundle. I've even tried just rebuilding my whole environment. Nothing allows me to prepare test cases though.

I am not sure how to remedy this issue/if there is a remedy. I have prepared a GIST with information about my environment and can update it with whatever information is needed to figure this problem out. I recently updated to Rails 4 and hope there is just some incompatibility I am overlooking. Sorry if this isn't the right place to ask about this, it's a rather ambiguous issue.

https://gist.github.com/shawndeprey/68653f2cae4c140f97d6

@shawndeprey

This comment has been minimized.

Copy link
Author

shawndeprey commented May 28, 2015

Maybe this will help, I did figure out some incompatibilities which may shed some light on this issue.

rails (= 4.2.1) ruby depends on
      activesupport (= 4.2.1) ruby depends on
        minitest (~> 5.1) ruby

It looks like Rails 4.2.1, the version I am using, depends on minitest 5.1. However, as you will see in the following the latest release version of minitest-rails (2.1.1) depends on minitest 5.4.

minitest-rails (= 2.1.1) ruby depends on
      minitest (~> 5.4) ruby

I can't find a version of minitest-rails which supports the same version of minitest as rails itself, and it seems like this might be the issue. Maybe minitest-rails and rails are technically incompatible in their current release states? Or am I just reading that wrong?

@tenderlove

This comment has been minimized.

Copy link
Contributor

tenderlove commented May 28, 2015

This is the right place! What version of Ruby and RubyGems are you using? What is the output of gem list minitest (without bundle exec)?

Those two should be compatible. If the version is X.Y.Z, then ~> 5.1 means X = 5, Y >= 1, Z = anything. ~> 5.4 means X = 5, Y >= 4, Z = anything. So minitest 5.4.X should work for both.

It seems like something is depending on minitest, and the spec is being activated before bundler has a chance to do it's thing. If you do bundle exec rake test:prepare, do you still get the warning?

@shawndeprey

This comment has been minimized.

Copy link
Author

shawndeprey commented May 28, 2015

Thanks for the quick response, I have been doing some testing based on what you said.

I am using ruby '2.2.2' combined with rubygems-bundler (1.4.4). The output I get from the gem list is the following:

$ gem list minitest

*** LOCAL GEMS ***

minitest (5.6.1, 5.4.3)
minitest-rails (2.1.1)

When I run bundle exec rake test:prepare I do not get the warning, in fact I don't get any output at all. However, the result is also the same as running the command without bundle exec. Does any of that information help?

@tenderlove

This comment has been minimized.

Copy link
Contributor

tenderlove commented Jun 8, 2015

Sorry, just to be clear: whey you run rake test:prepare, you get the error, but when you run bundle exec rake test:prepare, you don't?

@shawndeprey

This comment has been minimized.

Copy link
Author

shawndeprey commented Jun 9, 2015

@tenderlove yes, but in both cases the process still doesn't happen. That makes me think the error is just being suppressed.

@shawndeprey

This comment has been minimized.

Copy link
Author

shawndeprey commented Jun 25, 2015

@tenderlove I think I figured this one out, at least in part. So it looks like the spec reset might have been a red herring to the actual problem. My problem ended up being that my test database wasn't created. I got the idea to just manually create my database after checking out the following thread: rspec/rspec-rails#936

I used the following commands to do it:

RAILS_ENV=test;bundle exec rake db:create;RAILS_ENV=development
RAILS_ENV=test;bundle exec rake db:migrate;RAILS_ENV=development

I then was able to run my tests correctly with the following commands(depending on my use case):

RAILS_ENV=test;bundle exec rake test;RAILS_ENV=development
RAILS_ENV=test;bundle exec m test/functional/controllers/api/v4/companies_controller_test.rb:13;RAILS_ENV=development

All this is to say I think the red herring means this issue can be closed. I am not sure if I just missed something in the way you are supposed to configure your test environment in rails 4, but in any case the gem spec isn't the issue. Thanks for the help.

@SRod86

This comment has been minimized.

Copy link

SRod86 commented Aug 13, 2015

I was getting this same warning message too and thought I'd share what fixed it (for me).

Apparently, my issue was I had different versions of the same gem(s) and Rspec wasn't sure which to use. All I did was gem cleanup with the name of the gems popping up in the warning.

Ex1: gem cleanup minitest
Ex2: gem cleanup loofah

Once that was done, the warning went away. Hope this helps! :)

@troystarwalt

This comment has been minimized.

Copy link

troystarwalt commented Oct 12, 2015

Thanks for the follow up btw SRod86. Had the same error.

@Netznarkose

This comment has been minimized.

Copy link

Netznarkose commented Jan 12, 2016

@SRod86 your approach solved it for me!

@steakknife

This comment has been minimized.

Copy link
Contributor

steakknife commented Mar 14, 2016

There's another un/common pathology when using bundler with bundled projects and making the mistake of requiring bundled gems before require 'bundler/setup' can result in output similar to the following:

...
WARN: Unresolved specs during Gem::Specification.reset:
      minitest (~> 5.1)
      rake (>= 0.8.7)
WARN: Clearing out unresolved specs.
...

Solution: require bundled gems after bundler/setup, i.e., for Rails: require gems only after require 'bundler/setup' in config/boot.rb or later.

@agasthik

This comment has been minimized.

Copy link

agasthik commented Jun 2, 2016

@SRod86 . Your approach helped resolve a similar issue I was facing

WARN: Unresolved specs during Gem::Specification.reset:
json_pure (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
bash-3.2# gem cleanup json_pure
Cleaning up installed gems...
Attempting to uninstall json_pure-1.8.1
Successfully uninstalled json_pure-1.8.1
Clean Up Complete
@thinkbui

This comment has been minimized.

Copy link

thinkbui commented Feb 15, 2017

I ran into a similar problem with the same warning message. The problem was that I had both minitest-5.8.4 and minitest-5.9.0 installed. After running gem cleanup minitest to remove 5.8.4, rspec kept complaining that it was missing and bundling would reinstall it despite 5.9.0 also installed. In the end I was forced to run gem uninstall minitest to remove both versions and re-bundle.

I was never able to determine what was requiring 5.8.x specifically since no version was explicitly listed in my Gemfile and all of the dependencies I was able to find showed '~> 5.8' at the highest or something else that 5.9.0 should have met.

@kpheasey

This comment has been minimized.

Copy link

kpheasey commented Feb 22, 2017

RVM global gemset was the cause of my issue.

$ gem list minitest

*** LOCAL GEMS ***

minitest (5.10.1, 5.8.3)

gem uninstall minitest was only removing 5.10.x, but rvm @global do gem uninstall minitest removed the 5.8.x.

$ rvm @global do gem uninstall minitest
Successfully uninstalled minitest-5.8.3
@thom801

This comment has been minimized.

Copy link

thom801 commented Aug 31, 2017

Cleanup was not doing the trick but rvm @global do gem uninstall minitest solved it for me thank you @kpheasey!

@vynessa

This comment has been minimized.

Copy link

vynessa commented Oct 8, 2017

I used bundle clean --force and then ran bundle install to reinstall gems. Fixed the issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.